SPI1 DMA already allocated

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
sam76
Posts: 15
Joined: Fri May 03, 2013 8:07 am

SPI1 DMA already allocated

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: SPI1 DMA already allocated

Post 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
sam76
Posts: 15
Joined: Fri May 03, 2013 8:07 am

Re: SPI1 DMA already allocated

Post by sam76 »

I changed to alternate DMA stream, it works ! Thanks for help
Post Reply