3:03 pm
December 11, 2019
Hello
I am trying to control serial DAC (AD5530) by Uno board. I set CS pin 10. I tested with scope :
- At pin13 (clock) there are 600ns 8 clocks. I tried to change Clock Divider parameter to change clock width but it did not affected. How can I change clock width?
- Pin 11 (MOS) is always zero and not affected by transferred data.
D_A.vi is attached. This vi is based on MAX6675 Thermocouple to Digital Converter example.
9:56 pm
March 12, 2015
First of all, you are not using the clock divider correctly. Take a look at the comments of MAX6675 Thermocouple to Digital Converter.vi. For the Uno, there are only discrete settings as explained here.
https://www.arduino.cc/en/Refe.....ockDivider
They are #defines in the SPI library. So for divide by 8, you would use a value of 5. You have a value of 42 in the VI.
#define SPI_CLOCK_DIV4 0x00
#define SPI_CLOCK_DIV16 0x01
#define SPI_CLOCK_DIV64 0x02
#define SPI_CLOCK_DIV128 0x03
#define SPI_CLOCK_DIV2 0x04
#define SPI_CLOCK_DIV8 0x05
#define SPI_CLOCK_DIV32 0x06
#define SPI_CLOCK_DIV64 0x07
Also, you do not have a "Last" transfer mode, only "Continue". This will never end the transaction. This can be seen in the MAX6675 Thermocouple to Digital Converter.vi example.
12:28 pm
December 11, 2019
12:41 pm
August 16, 2019
Hi.
I have been using the Arduino Compiler for LabVIEW in an attempt to communicate with a Microchip MCP3208 A/D converter (datasheet http://ww1.microchip.com/downl.....21298e.pdf )
The attached VI “Learn SPI” contains the code which I believe should have worked.
However, the resulting SPI waveform had gaps of 5mS between each group of 8 pulses.
The "Detailed Help” for the SPI Transfer function, it states that “There is an automatic a 5ms delay after the slave select line is lowered before issuing the SPI transfer."
There is no indication in the Help text that this delay is included at the start of every SPI Transfer, even when the SS / CS line remains low, as in a “Continue” mode.
The data-sheet for the MCP3208 states that the SPI transfer must be completed within 1.2ms to meet the specification, which I do not seem able to achieve with the current ACfL SPI Functions
As a temporary work around and to confirm my understanding of the problem I checked the INO code, and commented out the "Delay(5)” commands
With these delays commented out, the resulting code worked as expected with only about a 6us gap between the three groups of SPI clock pulses.
Obviously this workaround is not practical for a SubVI which is going to be embedded in a higher level VI.
I have sent a Private Message to Tech Support and anticipate that the reply will also be posted here. I hope this helps someone else
8:27 pm
March 12, 2015
It is not super clear but the 5ms is added to all transactions since the slave select line is lowered, or held low, for all transactions. Since the peripheral does not control the CS line on AVR targets, this delay was intended to resolve some timing issues with certain SPI devices used by the Compiler. This obviously is not a catch all solution. You have a couple options:
1) Non-AVR targets, like the SAM core, control the CS line automatically so this delay does not occur. Switching targets may not be an option for you.
2) It is always best to use a specific Arduino library for a device when one is available. There is a library for your ADC lined below. Then you can simple create a wrapper for the Compiler to access the APIs and you dont have to worry about the SPI communication. There is an example that is shipped with the Compiler for the Digilent Analog Shield which has a very similar ADC. You could likely copy that and change the API calls for this library instead.
2:19 pm
August 16, 2019
1:53 pm
December 16, 2019
Steffan said
It is not super clear but the 5ms is added to all transactions since the slave select line is lowered, or held low, for all transactions. Since the peripheral does not control the CS line on AVR targets, this delay was intended to resolve some timing issues with certain SPI devices used by the Compiler. This obviously is not a catch all solution. You have a couple options:1) Non-AVR targets, like the SAM core, control the CS line automatically so this delay does not occur. Switching targets may not be an option for you.
2) It is always best to use a specific Arduino library for a device when one is available. There is a library for your ADC lined below. Then you can simple create a wrapper for the Compiler to access the APIs and you dont have to worry about the SPI communication. There is an example that is shipped with the Compiler for the Digilent Analog Shield which has a very similar ADC. You could likely copy that and change the API calls for this library instead.
https://github.com/MajenkoLibr.....es/MCP3208
Hi Steffan,
I am having the same issue of 5ms delay between every byte though it is hold low for full frame 10 byte. How can this 5ms be manipulted/edit? Where it is located? I havent seen anything in the SPI.h. Any work around except for changing the board? I was not expecting this behavour as long as I keep the CS low.
Thank you.
26
1 Guest(s)