- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I am currently working to capture data from a sensor and use a PSoC 4 to transfer the bytes to my computer using SPI and the PSoC SCB UART-- I have attached my current project. Currently, when I upload and run the program, I receive constant hex values of 72 on the CoolTerm serial monitor I am using, regardless of the sensor status. All of the wiring has been configured correctly and the SPI is operating at the correct parameters, so I believe there is a fundamental problem with my coding. I am not sure, but I think I have a basic misunderstanding of transferring bytes over UART.
Any help or nudge in the right direction would be most welcome! Please let me know if more info is needed.
Thanks in Advance!
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum.
For every bit (byte) the SPI interface gets, one bit (byte) is returned immediately. When the very first byte is sent, the interface does not "know" yet what to answer, so a dummy byte is returned which should be skipped.
SPI has no read command, so you must send dummy bytes to retrieve the information wanted.
There are APIs and #defined constants to check (and wait for) bytes received. Reading from SPI when nothing was received results in unknown data.
On UART side: your variables bx, by and er are 16 bit integers, only the lower 8 bits will be transmitted through the UART.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please update your PSOC Creator to PSoC Creator 4.1 (4.1.0.2686).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum.
For every bit (byte) the SPI interface gets, one bit (byte) is returned immediately. When the very first byte is sent, the interface does not "know" yet what to answer, so a dummy byte is returned which should be skipped.
SPI has no read command, so you must send dummy bytes to retrieve the information wanted.
There are APIs and #defined constants to check (and wait for) bytes received. Reading from SPI when nothing was received results in unknown data.
On UART side: your variables bx, by and er are 16 bit integers, only the lower 8 bits will be transmitted through the UART.
Bob