Page 1 of 1

SPI not working.

Posted: Mon Jun 01, 2015 8:09 am
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.

Re: SPI not working.

Posted: Mon Jun 01, 2015 8:50 am
by Giovanni
Are debug options enabled in chconf.h?

The usual SPI demo for the F0 runs normally here.

Giovanni

Re: SPI not working.

Posted: Tue Jun 02, 2015 8:26 am
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).