LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the 'General SPI Read.vi' example to function with an MS5803-01 Pressure Sensor

I'm currently trying to modify the 'General SPI Read.vi' to work with the MS5803-01 pressure sensor (datasheet attached), with no luck so far. The steps I took to modify it and the results are listed below. I have extremely limited Labview knowledge, so I really appreciate having even the simplest errors pointed out to me. Thanks in advance for any assistance!

 

Changes made to the code:

-Upon opening the example, the input to the 'close reference.vi' is incorrectly wired, so i connect that to the device reference

-Set the device (NI USB 8452) and Chip Select (4) on the front panel

-Set the number of bytes to read to 3 (24 bit result from the ADC)

-Add a control ('WRITE') to allow changing of the written bytes

 

Things I know:

The sensor needs to be sent '1E' to reset first

Next, 'A0 - AE' in order to read the calibration coefficients (should receive a 16 bit result each time)

Next, '48' or '58' in order to trigger the conversion of the two data points

Lastly, '00' to read the ADC and return a 24 bit result for the data point

 

Things I don't know:

The EEPROM Data address (and address width), I can't find any mention in the datasheet of the address I should be sending my command bytes to.

 

Current Result when Run:

Error -301735

- NI-845x: The number of bits provided is invalid. Refer to your documentation to determine valid values.

I can't find any further info on this error, but my assumption was that the labview code was receiving a different number of bits from the 8542 than it was expecting. I thought this would be to do with the 'Number of Bytes to Read' setting, but I tried a variety of options without any luck.

 

Current hardware setup:

An MS5803-01 pressure sensor, connected to an NI-8452 using the MISO, MOSI, SCLK and CS(4) connectors. Wired as prescribed in the datasheet. It is connected to a 3.3V power source with a 100nF capacitor between Vdd and ground. The PS pin is pulled to ground as well.

 

As I mentioned before, my labview and digital signal knowledge is very limited. I've done extensive searching online to try find a guide that could help me get this set-up, and I've tried a variety of examples and guides, but I haven't found anything that helped. I decided to post this using the official labview example, since it seems like it should be the simplest to modify. Once again appreciate any assistance. Cheers! Bruce

0 Kudos
Message 1 of 4
(3,843 Views)

Hi Brucems,

 

Thank you for providing such a detailed problem description with attachments!

 

What versions of software are you using, specifically LabVIEW and NI-845x? You can find this in the application NI MAX and looking in the software tab.

 

Where is the error occurring in your code? This will be listed under Source in the error message that pops up after running your code. I noticed there is a wire missing for “spi configuration” from the “NI-845x SPI Configuration” property node to the “NI-845x SPI Write Read” VI. This will be the light blue line in my attached screenshot. I also wired my device reference to the “Close Reference” VI, but I have not been able to test this with hardware yet.

 

Best,

Chris D. | Applications Engineer | National Instruments

0 Kudos
Message 2 of 4
(3,782 Views)

Hi Chris, 

 

Appreciate the response!

 

I'm using an 8452 in Labview 2015.

 

When I first open the SPI read example, both segments of that light blue line are broken, as shown in the two screenshots below. The second segment of the line going to the close reference VI is actually meant to contain the device reference, not the device config, which is why I rewired it originally. I can't figure out where the first segment of the line was going to (it doesn't seem to be wired to a visible input on the SPI write/read vi), which is why I deleted it originally.

 

If I remove both segments of the broken wire and connect the device reference to the close reference VI (the setup I showed in my first post), then the code will attempt to run, but the error is

Error -301734

Possible reason(s):

NI-845x: The number of bits provided is invalid. Refer to your documentation to determine valid values.

 

My guess is that due to my lack of knowledge regarding the SPI protocol, one of the following things is causing this: 

- The data address is incorrect; my interpretation of the sensor data sheet (relevant page attached, complete datasheet attached in prev. post) was that the address was embedded in the command bytes, so I've been using the 3 bits labelled AD0 - AD2 as the address. E.g. 0x06 as the address for the reset command.

- The clock rate is set incorrectly; I couldn't find any info in the sensor data sheet on this so I've currently left it at the default 1000kHz

- One of the other front panel settings is incorrect - I'm using data address width as 1 Byte and number of Bytes to Read as 3, although I've tried a variety of combinations of settings for these with the same error.

- The change I made to the write array (creating a control to choose an unsigned 16 bit variable, instead of sending 0) is the incorrect way to send the command bytes to the sensor.

 

Beyond these, I'm not too sure what could be the problem.

 

Thanks for taking the time to help! 

 

Cheers, Bruce

 

 

 

 

 

 

Download All
0 Kudos
Message 3 of 4
(3,773 Views)

Hello brucems

 

I was checking the first post and I am wondering if you tried to run de VI as default in order to make sure we are stablish any communication. I know that you need to receive 24 bit but it is just to test it

  

Regards

0 Kudos
Message 4 of 4
(3,757 Views)