SPI not working.

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

Moderator: RoccoMarco

Post Reply
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

SPI not working.

Post by rew »

[update: It works a bit better if you use the right AF ]

I don't understand: I used to have it working, but now it no longer works... :-(

Anyway, when I send something over SPI using

Code: Select all

 spiSend (&MYSPI, 1, &ch);
(MYSPI is defined to SPID2 here), it does spiStartSendI(spip, n, txbuf); and then suspends. It is waiting for the DMA transfer to finish, but I never see the wakeup happening.

I'm now doing the SPI from a second thread, so that I can use my own embedded debugging code to debug things:

Code: Select all

> dumpm 40003800
40003800  00000374 00001707 00000002 00000000
This is the SPI2 peripheral. The third word seems to indicate: TXE. So the SPI module is waiting for DMA to fill the TX buffer. Correct?

So examining the DMA module:

Code: Select all

> dumpm 40020000
40020000  00070000 00000000 00000000 00000000
the interrupts for DMA5 are enabled.

Code: Select all

> dumpm 40020058
40020058  00001099 00000000 4000380c 20001515
Here everything looks good, except for the count: it is zero.

Further suggestions?

P.S. SYSCFG->CFGR1 is zero.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: SPI not working.

Post by Giovanni »

Are debug options enabled in chconf.h?

The usual SPI demo for the F0 runs normally here.

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: SPI not working.

Post by rew »

Yeah. That's a plan. First modify the example get that to work, and then try to re-integrate with the source I have. Thanks for the suggestion. (it works better with the proper pin AF's selected, but not quite yet. It might be set too fast. I'll dust off the logic analyser first).
Post Reply