Page 1 of 1

SPI1 DMA already allocated

Posted: Mon May 06, 2013 2:33 pm
by sam76
Hi,

I just ported my project from freertOs to ChibiOs, it work well exept one thing, the spi bus.

I use a ssd1322 based Oled display with spi1, the spiStart function freeze.

this is the stack :

Code: Select all

(gdb) where
#0  port_halt () at ../ChibiOS_2.5.1/os/ports/GCC/ARMCMx/chcore.c:43
#1  0x08000a96 in chDbgPanic (msg=0x80512c4 "spi_lld_start(), #2") at ../ChibiOS_2.5.1/os/kernel/src/chdebug.c:267
#2  0x080110d4 in spi_lld_start (spip=0x20008a2c) at ../ChibiOS_2.5.1/os/hal/platforms/STM32/SPIv1/spi_lld.c:233
#3  0x0800b560 in spiStart (spip=0x20008a2c, config=0x8051d30) at ../ChibiOS_2.5.1/os/hal/src/spi.c:108
#4  0x0802bfaa in u8g_com_stm32_hw_spi_fn (u8g=0x20008070, msg=1 '\001', arg_val=0 '\000', arg_ptr=0x0) at U8glib/utility/u8g_com_stm32_hw_spi.c:116
#5  0x0802afbc in u8g_InitCom (u8g=0x20008070, dev=0x20000958) at U8glib/utility/u8g_com_api.c:41
#6  0x0802c17c in u8g_dev_ssd1322_nhd31oled_gr_fn (u8g=0x20008070, dev=0x20000958, msg=10 '\n', arg=0x0) at U8glib/utility/u8g_dev_ssd1322_nhd31oled_gr.c:274
#7  0x0802b422 in u8g_call_dev_fn (u8g=0x20008070, dev=0x20000958, msg=10 '\n', arg=0x0) at U8glib/utility/u8g_ll_api.c:44
#8  0x0802b452 in u8g_InitLL (u8g=0x20008070, dev=0x20000958) at U8glib/utility/u8g_ll_api.c:53
#9  0x0802b7b0 in u8g_Init (u8g=0x20008070, dev=0x20000958) at U8glib/utility/u8g_ll_api.c:177
#10 0x08040bfe in display (p=0x0) at Display/display.c:142
#11 0x0800048e in _port_thread_start () at ../ChibiOS_2.5.1/os/ports/GCC/ARMCMx/chcore_v7m.c:255
#12 0x080010b8 in chSchWakeupS (ntp=0x0, msg=0) at ../ChibiOS_2.5.1/os/kernel/src/chschd.c:233


the spi_lld.c file say the dma stream is already allocated (assigned?).

I have started from the USB/WEB/LWIP demo
HAL_USE_SPI is set to TRUE
STM32_SPI_USE_SPI1 is set to TRUE

So, something use the DMA 2 stream 0 ? I don't find what.

Re: SPI1 DMA already allocated

Posted: Mon May 06, 2013 4:06 pm
by Giovanni
Hi,

The default SPI1 DMA channels conflict with the SDC driver, you have to remap one of them to one of the alternate channels in mcuconf.h. The possible alternates for SPI1/SDIO are listed in the RM in the DMA section, table 34.

Giovanni

Re: SPI1 DMA already allocated

Posted: Tue May 07, 2013 8:08 am
by sam76
I changed to alternate DMA stream, it works ! Thanks for help