How to transmit hex data over spi?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-27 9:53 AM
I want to transfer binary data (not character) without having to worry about character conversion, so directly:
uint8_t data = 0xBF;
HAL_SPI_Transmit(&spi1handle, (uint8_t *) data, 1, 1000);
But I get something else at the receive end, specifically I get for example 0xDC so not the same data that I send. As a beginner I would like to know how I can make the above work.
- Labels:
-
SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-27 10:48 AM
This was the correct approach.
You need to double check clocking and phase options at both ends.
>>But I get something else at the receive end.
Unfortunately you don't state what. Perhaps shifted one bit left or right?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-27 11:37 AM
Note that SPI needs a method to synchronize bytes, typically through use of a CS pin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-27 2:37 PM
@Community member​ @TDK​ Do I need to do something with the bits at the receive ends? I expect that if I send 8 bits which is 0xBF , I receive those 8 bits (configured it for 8 bits data). I will try again, how can I best debug this kind of problem?
