LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LIFA SPI Read Problem

I have successfully used the LIFA SPI VIs to write to and control various devices but this is the first time attempting writing to and reading from a device and I am having some problems.  I am using LabVIEW 2012, LIFA 2.1.1.69, and an Arduino Uno R3. I am writing and reading 4 bytes.  I am successfully sending C0 00 00 00 to the device as can be seen on the oscilloscope screenshot for MOSI.  The device is correctly sending 0F F0 ED CB as can be seen for MISO. The problem is that LabVIEW is reading/displaying different results, all incorrect, for every read/write cycle even though the oscilloscope is correct every time. Some of the incorrect data LabVIEW displays: 32 30 33 30, 31 35 32 34, 30 30 30 30, 32 33 37 32 and so on. Does anybody have any idea what could be going on? Thanks in advance.

Download All
0 Kudos
Message 1 of 8
(5,790 Views)

I also had the same issue. It returns garbage but when I did a logic analysis, I see sending right information. let me know if you find a solution.

RY
0 Kudos
Message 2 of 8
(3,799 Views)

Hey,

2.1.1.69 is not the current version of LIFA so its possible there was an old bug that has since been fixed.  However rather than upgrade LIFA versions I'd suggest you try LINX (the successor to LIFA).  If a problem exists in LINX I'll be able to fix it.  LIFA on the other hand won't receive any more updates.

Please let me know if you have any more questions.

Thanks!

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 3 of 8
(3,801 Views)

Hi Sam,

Thanks for your response. Is LINX just new firmware that would be loaded to the Arduino and I would be able to use my existing Arduino LabVIEW VIs? Or is there more to it than that?

Vinny

0 Kudos
Message 4 of 8
(3,801 Views)

LINX is the successor to LIFA.  It is a completely new toolkit built from the ground up (ie no code is shared between LIFA and LINX) but LINX works very similar to the way LIFA does.  Most LIFA VIs have a 1 to 1 LINX replacement so it should be easy to upgrade existing code from LIFA to LINX.  As I mentioned LIFA will no longer be updated but LINX will so it is recommended that everyone switch to LINX.

Let me know if you have any more questions about this.

Thanks!

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 5 of 8
(3,801 Views)

Hi Sammy,

I am unable to configure the firmware. Could you give some pointers?

RY
0 Kudos
Message 6 of 8
(3,801 Views)

Hey Sam,

Just installed LINX and rebuilt my VI with the new LINX VIs and the SPI read now works! Thanks for your help.

One thing though, I am unable to change the clock frequency in the SPI Configure.vi.  It is running at 4MHz regardless of what I enter into the control.  I then noticed the Clock Frequency element of the cluster is not wired to anything.  Can you help with that?

Thanks,

Vinny

0 Kudos
Message 7 of 8
(3,801 Views)

Hey Vinny,

Glad to hear it is working for you now.

As you mentioned the SPI clock frequency is hard coded in LINX (for now).  The reason for this is because different devices use different source clocks and dividers and therefore support different SPI clock frequencies.  I left the clock at the default frequency for now so I could focus on other areas of development.  This is something I've marked as needing work and I just added it to the Github issue tracker here.

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 8 of 8
(3,801 Views)