- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Every body,
I am doing SPI communication between Pi and PSOC 5LP.
I placed a command
while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE));
But by doing this, my program just takes too long to fulfill the condition and when I replace the above condition with just:
while(!(SPIS_STS_SPI_DONE));
It does not!
I wonder why it is behaving so wierd?
Looking forward to your answers!
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
while(!(SPIS_STS_SPI_DONE));
The above is testing a constant value for zero. SPIS_STS_SPI_DONE is a #defined value to check for a bit pattern. Checking with
while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE));
will indeed consume MIPS. Think about to use a "callback macro". Look for that term in SPI datasheet and in Creator help.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
while(!(SPIS_STS_SPI_DONE));
The above is testing a constant value for zero. SPIS_STS_SPI_DONE is a #defined value to check for a bit pattern. Checking with
while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE));
will indeed consume MIPS. Think about to use a "callback macro". Look for that term in SPI datasheet and in Creator help.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE));
will wait until the SPI communication really is finished. Yes, this will take time since it takes a while for that (depending on your SPI clock speed). There is nothing you can do about it.
Using a callback macro can help you to use the CPU during that time for something else (e.g. it can sleep, or calculate something else). But in any case, the time needs to be spend.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Bob and hli for your suggestions.
I have a problem with buffer synchronization between pi and psoc. Any suggestion how i can over come this?