I'm running on a STM32F4, first on the discovery board, then on a modified FEZ40 (SPI pins brought out), and I'm trying to understand a couple of things with ChibiOS, since I'm still a total newbie on this.
I'm trying to do back to back SPI transfers, so start a new one as soon as one finishes. Note, this has little practical use, I'm just trying to gauge how things work.
In a thread:
Code: Select all
while (TRUE)
{
palSetPad(LED2_PORT, LED2_PAD);
spiAcquireBus(spid);
spiSelectI(spid);
spiStartSendI(spid, sizeof(buf), buf);
}
In the SPI configurations, there's a callback:
Code: Select all
chSysLockFromIsr();
spiUnselectI(spip);
spiReleaseBus(spip);
chSysUnlockFromIsr();
And it crashes in spiReleaseBus(), in chMtxUnlock(), ending in a _unhandled_exception.
I imagine that this is not the way to do it, and wanted feedback on what the best way to go around it. I imagine that a better solution would be to call spiPolledExchange(), but it's more of a question on how I can reasonably manage 2 threads, to get one to start an SPI transfer once another finishes...
