LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI myRIO with LTC6811-1 SPI Communication Issues

Hi LabVIEW Community,

I am facing some problems with interfacing NI myRIO with Linear Technologies evaluation board DC2259A which contains LTC6811-1 chipset USE to monitor battery cell voltage for BMS System

 

When writing to the LTC6811, it uses SPI Mode 3. However, the LTC6811-1 is not communicating properly with myRIO.

 

For example, if I send in the command 0x0001 (command code write configuration), with the PEC calculated of the command code of 0x0001 to be 3D6E, and the configuration to be
0xF8 00 00 00 00 00 with it calculated PEC, the response I getting back is 0x FF FF FF FF FF FF, which does not tally. I am supposed to receive back 0xD8 00 00 00 00 00 with its calculated PEC.

 

Did I do something wrong with the configuration of my VI? Also, do I still need the connection of the 5K resistor to the myRIO VCC MISO input too? I thought the myRIO has internal pull-up resistors for it. 

This is based on Figure 15 Pg 44 of the datasheet of the LTC6811-1.

 

I have attached my VI in the post, together with the datasheet of the LTC6811-1 and the schematic of the evaluation board which uses the LTC 6811-1 Chip. 

SPI Connection Pages in the Datasheet (Pg44,45,55-66)

Operation of the LTC6811-1 (Pg 20-36)

 

I have linked the hardware connections from the board J2 connections to the myRIO.

VCC to 5V input of the myRIO

SCK  to Clock Input of myRIO DIO 5 MXP A Connector

MISO to MISO Input of myRIO DIO 6 MXP A Connector

MOSI to MOSI Input of myRIO DIO 7 MXP A Connector

CS to DIO0 of myRIO DIO0 MXPA Connector (I have set it to False in the VI)

 

Can any kind soul advise me on this matter, please? Thank you!

Regards,

cyongjed

 

0 Kudos
Message 1 of 5
(1,404 Views)

I might be able to help, as I'm using myRIO to control 16 boards all with multiple SPI chips (fortunately, I only need to get rapid communication from the SPI A/D chip on each of the 16 boards, and can "make do" with a sampling rate around 20 kHz).  Needless to say, we are "rolling our own" SPI signals, but that's pretty much also what the SPI routines you are using are trying to do.

 

Unfortunately, you did not attach the entire LabVIEW Real-Time Project, particularly, the Project File (and the supporting VIs that you might have developed).  Please do the following:

  1. Right-click the folder containing your 17 May 22 LV21 Project, including the .lvproj Project file and (I presume) the Main VI and all the supporting VIs that you are using. 
  2. The Project File should show these VIs residing on a NI myRIO-1900.  It should also show the Main.vi file and any/all supporting VIs that you may have developed for this application.  Don't worry if some of them are in an "unfinished" state.
  3. The Project File should also include any/all TypeDefs that you may have created for this Project.
  4. When you have identified (or created?) a Folder with the Project File and all the supporting VIs (including Main), right-click this folder, choose "Send to" from the drop-down, and choose "Compressed (zipped) Folder".
  5. Attach the resulting .zip file to your reply.

Bob Schor

  1. The Project 
0 Kudos
Message 2 of 5
(1,380 Views)

Hi Bob,

I have reuploaded the zip file. Could check if you are able to view it (I have used the myRIO project template to create a new project from the LabVIEW startup page, I didn't create it from the real-time module project wizard)

 

Also, the sampling rate, I don't really get for this, how do I set it? For my current case, I still set the myRIO with 1Mhz frequency for the clock phase = trailing, clock polarity=high.
I attached images from the datasheet for your reference too.

Screenshot 2023-05-23 211642.pngScreenshot 2023-05-23 211437.pngScreenshot 2023-05-23 211500.png

Hope to hear from you soon!

Regards,

Cyong

0 Kudos
Message 3 of 5
(1,328 Views)

Hello, Cyong.

 

     I'm able to open your Project, and your VI.  However, I'm attending NI's annual Trade Show (now called NI Connect), and won't have access to a myRIO until I return home tomorrow and go back to work.  I'll also print out the datasheet you sent (my poor eyes can't read such fine print) and will try to answer your questions.  I should mention that I am not an Engineer (look at my Avatar and guess what I do), so I may need to consult some of my colleagues about some of the SPI details (though I've programmed the SPI protocol in the myRIO's FPGA, so I can look at my own code and maybe "figure it out" for myself) ...

 

Bob Schor

0 Kudos
Message 4 of 5
(1,300 Views)

Hi Bob,

I have solved the issue. There were quite a number of problems in my design of the QSM. I didn't set back the CS lines back to high once a data read is attempted and the clock frequency is too high, hence the read was invalid.

I have since adjusted my clock frequency to 30kHz, and set the CS lines back accordingly. Thanks for the help!

0 Kudos
Message 5 of 5
(1,249 Views)