-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement asynchronous SPI interface #15
Conversation
Each SPI driver now has its own static Handle which allows for resource control for multiple accesses as required by the current asynchronous API.
Also add debug output.
Build finished. No test results found. |
1 similar comment
Build finished. No test results found. |
Also please note that I only added the asynch APIs, but did not fundamentally fix the problem inherited by the synchronous API, which are mostly related to providing safe mutual exclusion for multi-access. Specifically, the current implementation of SPI (well, really any API of the entire HAL) is not safe for true asynchronous operation. |
No worries, we won't hunt you for that one. As noted, we are not there yet. Can you please fix formating with these new changes, reason - consistency |
else { | ||
// everything is ok, nothing else needs to be transferred | ||
event = SPI_EVENT_COMPLETE | SPI_EVENT_INTERNAL_TRANSFER_COMPLETE; | ||
// somehow this is needed, dunno why. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated comment?
Could you please ellaborate a bit on this? Why 3 interrupts? |
I'm still a little confused by there are 3 interrupts per byte. I can reason for 2 interrupts per byte for TXRX transfers, because of the TxEmpty and RxNotEmpty interrupts. @0xc0170 just now found this (undocumented) gem in the Cube library in the In the unittest I memset the rx buffer and therefore I saw zeros in the tx line, instead of 0xff, which is the For the tx only part, I now believe that I prematurely disabled the interrupt here, and therefore disallowed the tx-only configuration in Cube to properly unconfigure its internal states, and therefore it just continued the previous transfer on the next transfer. |
Fix length calculation for 16bit transfers. Do not disable interrupt prematurely.
Build finished. No test results found. |
1 similar comment
Build finished. No test results found. |
"Conform" they whispered. "Conform" they chanted. "Conform" they wanted.
Build finished. No test results found. |
1 similar comment
Build finished. No test results found. |
Ok, so I've fixed the reception, it is now much more efficient. Interrupts per byte:
I still didn't find a fix for using the I now also "conform" to coding style. |
Looks good to me. Unknown state for HAL_SPI_Transmit_IT - Shall we leave TODO there to remind us to look at this (or even a issue), https://github.com/ARMmbed/mbed-hal-st-stm32f4/pull/15/files#diff-bc7df4243a454d3629b0f7efffec53f7R461 |
Build finished. No test results found. |
1 similar comment
Build finished. No test results found. |
Build finished. No test results found. |
1 similar comment
Build finished. No test results found. |
Implement asynchronous SPI interface
Adds the functions as defined by the asynchronous interface in mbed-hal.
Successfully tested using the asynch-spi unittest in mbed-hal.
It uses interrupts for now (3 interrupts per transferred byte).
These changes rely on ARMmbed/mbed-hal-st-stm32f429zi#13.
@bremoran @bogdanm @0xc0170