SPI/DMA error (STM32_SPI_DMA_ERROR_HOOK)
Posted: Tue Feb 04, 2014 10:48 am
Hi
I'm trying to test a SPI device (a BMA250 accelerometer) on an Olimex STM32-P407 development board. I've connected my SPI wires to the UEXT port of the board; I'm not sure if it is supposed to work but anyway I don't think it is related to my problem.
The problem is that I get a DMA error when I call spiSend: STM32_SPI_DMA_ERROR_HOOK is called by spi_lld_serve_tx_interrupt, apparently because the STM32_DMA_ISR_TEIF flag is set (the debugger shows flags == 0x09).
Here is my SPI code:
Any idea what could be causing this error?
I'm trying to test a SPI device (a BMA250 accelerometer) on an Olimex STM32-P407 development board. I've connected my SPI wires to the UEXT port of the board; I'm not sure if it is supposed to work but anyway I don't think it is related to my problem.
The problem is that I get a DMA error when I call spiSend: STM32_SPI_DMA_ERROR_HOOK is called by spi_lld_serve_tx_interrupt, apparently because the STM32_DMA_ISR_TEIF flag is set (the debugger shows flags == 0x09).
Here is my SPI code:
Code: Select all
const SPIConfig spiConfig =
{
0,
GPIOF,
GPIOF_SPI3_SS,
SPI_CR1_BR_2
};
palSetPadMode(GPIOC, GPIOC_SPI3_CLK, PAL_MODE_ALTERNATE(6));
palSetPadMode(GPIOC, GPIOC_SPI3_MISO, PAL_MODE_ALTERNATE(6));
palSetPadMode(GPIOC, GPIOC_SPI3_MOSI, PAL_MODE_ALTERNATE(6));
palSetPadMode(GPIOF, GPIOF_SPI3_SS, PAL_MODE_OUTPUT_PUSHPULL);
spiStart(&SPID3, &spiConfig);
spiSelect(&SPID3);
uint8_t address = 0x00;
spiSend(&SPID3, 1, &address); // <--- error here
uint8_t chipid = 0;
spiReceive(&SPID3, 1, &chipid);Any idea what could be causing this error?