LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI and UART

Hi Everyone,
Hope all is well. I am new to the lab view environment and embedded design and I have a question that I am hoping you all will be able to help me with. On the SPI and UART example I have found that changing the baud rate will increase the clock speed during a sample, however, there is a gap in between samples. Is there anyway that I can reduce this gap so that at a high frequencies I can make the end of one clock cycle closer to the beginning of another? Specifically, I would like to sample 16 bit data from the spi at 240 ksamples/second. Please let me know and thanks in advance for the help.
~rrobinson
0 Kudos
Message 1 of 7
(7,901 Views)

Hi,

I believe the behavior you are seeing is relatively expected. This example does not make an attempted to have things super synchronized. For example: inside the main VI there is a subVI called Device Single Word ReadWright. The last thing this subVI does is disable the SPI and thus it has to be enabled the next loop iteration. This example is probably not optimized to do exactly what you want. You will probably need to come up with some buffering scheme of your own. To see how the buffers are set up in this example you can open up the SPI Action.vi.    

Charlie M. CLD
0 Kudos
Message 2 of 7
(7,874 Views)
The other thing that you want to watch out for is that you aren't running parallel loops.  This will add a gap when the OS flips between loops, causing a large delay in your data.  If you want it continuous at those speeds, make sure to only use one loop.
0 Kudos
Message 3 of 7
(7,861 Views)
Hi, thanks so much for replying to my thread, I really appreciate the help. If you dont mind I was wondering if you also knew how hard it is for code written on the blackfin 537 to be transferred to the 538? Please let me know and thanks again.
~rrobinson
0 Kudos
Message 4 of 7
(7,849 Views)
This should be real simple.  In your LabVIEW Project, you have a BF537 target.  Simply create a new BF538 target, drag (or copy) your VI's down to the new 538 target, and build a new Build Specification.  Rebuild the application under the 538 target, and that should create all new C files for that target.  I'm not sure what capabilities are added/removed from the 537 to the 538, but if you are only using SPI, you should be all set.

Let me know how it goes, I haven't used a 538 target yet!  Good Luck!!!
0 Kudos
Message 5 of 7
(7,847 Views)

Hi Charlie M,

 

In a previous post on this thread, you mention that the  Device Single Word ReadWrite.vi found in the SPI and UART example is not optimized at all.  Do you (or does anyone else) have any example code that is optimized?  I'm seeing a delay when running SPI Transactions in a loop, but when I get rid of the Enable/Disable of the SPI Device it runs faster but returns incorrect data.  I've been experimenting with using the BF Device Wait Buffer.vi, but to no avail.

 

Thanks!

0 Kudos
Message 6 of 7
(7,359 Views)

Hi jmburns,

 

Unfortunately, we do not the example code you are looking for.  Perhaps another forum user may have optimized code that they are willing to post.

 

Regards,

 

Kevin H

National Instruments
WSN/Wireless DAQ Product Support Engineer
0 Kudos
Message 7 of 7
(7,339 Views)