Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix dropped bytes on spi write #11660
The cyhal_spi_send api was changed to read and discard a byte on every
Pull request type
The cyhal_spi_send api was changed to read and discard a byte on every send operation (at the protocol level all SPI transfers are bidirectional). This means that to achieve a truly bidirectional transfer, the cyhal_spi_transfer API must be called (as opposed to a write followed by a read).
kjbracey-arm left a comment
This wouldn't be quite right if configured for > 8-bit transfers, but not sure this HAL (or even the Mbed OS core) correctly supports that case anyway. (There's a seperate SPI feature branch which I believe is looking at that, among other things).
None of that is specified - some of the code suggests that the intent is that it work, and there's no reason it shouldn't. (
The SPI feature branch drops that HAL API anyway, and sends it all through
And tests it. I don't think any of this is tested on master.
I was just checking the docs :
@shuopeng-deng Is this fix correct - cypress driver states it supports 8 or 16 bits (format function docs).
You could basically cheat and rely on the little-endianness - just make both
(This trick working is why little-endianness is the one true endianness).