Author Topic: SPI Issue working with the ADS8684  (Read 505 times)

0 Members and 1 Guest are viewing this topic.

Offline DudogamaTopic starter

  • Newbie
  • Posts: 7
  • Country: de
SPI Issue working with the ADS8684
« on: January 23, 2025, 07:11:22 am »
I am currently working on a project for my masters degree and I ran int a problem. I am using an Arduino Portenta H7 as interface between a PC and an ADC. The data transfers via SPI and goes through a digital isolator. I am trying to read some of the registers of the ADC, but I only receive 0xFF as answer.

I have use multiple reference projects using the same ADC without any progress and I am not sure, if the Problem lies in the Software or the Hardware. The ADC is soldered onto the PCB and is not easy to remove, so I can`t really test it in isolation. Any help would be much appreciated.
The full circuit Layout and Pin assignment is attached.

This is the code, i have been using to read the most basic registers to verify the functionallity written in Arduino IDE attached to this post

Thx for your help  :)

« Last Edit: January 23, 2025, 07:40:10 am by Dudogama »
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2265
  • Country: au
Re: SPI Issue working with the ADS8684
« Reply #1 on: January 23, 2025, 07:49:00 am »
Looking at the datasheet page 46, to read a register /CS goes low, then an 8 bit address is sent with the MSB set to 0 then a 16 bit read takes place and /CS goes high.
Your code:

Code: [Select]
uint16_t readRegister(uint8_t regAddr) {

uint16_t command = (regAddr << 8);

digitalWrite(CS_PIN, LOW);

SPI.transfer16(command);

digitalWrite(CS_PIN, HIGH);

digitalWrite(CS_PIN, LOW);

uint16_t data = SPI.transfer16(0x0000); // Dummy write to read

digitalWrite(CS_PIN, HIGH);

return data;

}

seems to be a 16 bit write for the address /CS low then /CS high, then a 16 bit read /CS low then /CS high, not the same.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3376
  • Country: us
Re: SPI Issue working with the ADS8684
« Reply #2 on: January 23, 2025, 08:02:54 am »
You can wrap your code in [code ] blocks - it'll be easier to read.

Here is what seems to be the pin and signal assignments:

Code: [Select]
Function  Arduino   Net Name    ISOW       ADC
SCLK      D9 (18)   ADC_CLOCK   INB (4)    SCLK (37)
CS        D7 (16)   SPI_SS      INA (3)    CS_N (38)
MISO      D8 (17)   INC_NC      INC (5)    SDI (1)
MOSI      D10 (19)  ADC_OUT     OUTD (6)   SDO (36)

Pin number are in parentheses. Please check and see if I have made any mistakes.

If these are the assignments then I think that MISO on the Arduino should be connected to the ADC_OUT net and MOSI connected to INC_NC.

Also, have a look at these discussions:

https://forum.arduino.cc/t/minimal-example-of-spi-for-portenta-h7/695207/2

https://github.com/arduino/ArduinoCore-mbed/issues/131
« Last Edit: January 23, 2025, 08:08:49 am by ledtester »
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2265
  • Country: au
Re: SPI Issue working with the ADS8684
« Reply #3 on: January 23, 2025, 08:04:30 am »
Perhaps for code something like this:

Code: [Select]
uint16_t readRegister16(uint8_t regAddr)
{
uint16_t data;
regAdrr = regAddr & 0x07f;

digitalWrite(CS_PIN, LOW);
SPI.transfer8(regAddr);
data = SPI.transfer16(0x0000); // Dummy write to read
digitalWrite(CS_PIN, HIGH);

return data;
}
 

Offline DudogamaTopic starter

  • Newbie
  • Posts: 7
  • Country: de
Re: SPI Issue working with the ADS8684
« Reply #4 on: January 23, 2025, 09:13:55 am »
Thx for your reply, unfortunatly the Code is not working so far.
 

Offline DudogamaTopic starter

  • Newbie
  • Posts: 7
  • Country: de
Re: SPI Issue working with the ADS8684
« Reply #5 on: January 23, 2025, 09:27:41 am »
Thx for your reply.
I think you accidently switched MISO (D10) and MOSI (D8).
 

Offline BennoG

  • Regular Contributor
  • *
  • Posts: 224
  • Country: nl
Re: SPI Issue working with the ADS8684
« Reply #6 on: January 23, 2025, 09:31:23 am »
this is where a scope would be of great value.

Benno
 

Offline DudogamaTopic starter

  • Newbie
  • Posts: 7
  • Country: de
Re: SPI Issue working with the ADS8684
« Reply #7 on: January 23, 2025, 01:23:01 pm »
I scoped the SPI Bus, while sending increasing +1 (loop) Hex Values. There is something going on with the SPI_MODE1 setting. The last bit stays at HIGH till the start of the next loop cycle, with many false data in between (0xFF....).
Code and screens are attached.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3376
  • Country: us
Re: SPI Issue working with the ADS8684
« Reply #8 on: January 23, 2025, 03:00:36 pm »
I have a question about this code:

Code: [Select]
  // Configure reset pin
  pinMode(reset_PIN, OUTPUT);
  digitalWrite(reset_PIN, HIGH); // reset ADC

Does it affect the ADS8684?

 

Offline DudogamaTopic starter

  • Newbie
  • Posts: 7
  • Country: de
Re: SPI Issue working with the ADS8684
« Reply #9 on: January 23, 2025, 03:43:13 pm »
If the Reset Pin is not pulled HIGH via a pull-up resistor or set to HIGH in software, it will not function correctly.
We initially forgot to add a pull-up resistor, but a 3.6 V HIGH can still be achieved with these code lines.
 

Offline DudogamaTopic starter

  • Newbie
  • Posts: 7
  • Country: de
Re: SPI Issue working with the ADS8684
« Reply #10 on: January 23, 2025, 03:49:31 pm »
Another major issue has arisen.

We analyzed the SPI bus signals before and after passing through the digital isolator (ISOW7841) using an oscilloscope. The signal quality is extremely poor, and some bits fail to meet the HIGH-level threshold for the ADS8684, showing values of only 2.5–3 V. This is evident in the attached images: "Before_iso_INC(MOSI)" and "After_iso_INC(MOSI)".

At this point, the only potential fix I can think of involves modifying the voltage levels. The same goes for the CLK.
 

Offline DudogamaTopic starter

  • Newbie
  • Posts: 7
  • Country: de
Re: SPI Issue working with the ADS8684
« Reply #11 on: January 23, 2025, 05:16:39 pm »
We forgot to connect the Picoscope ground (GND) to the isolated ground (GND) of the board. I'll take measurements again tomorrow—hopefully, I can find the solution then. Thanks for all your responses today!  :)
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3376
  • Country: us
Re: SPI Issue working with the ADS8684
« Reply #12 on: January 23, 2025, 05:22:43 pm »
If the Reset Pin is not pulled HIGH via a pull-up resistor or set to HIGH in software, it will not function correctly.
We initially forgot to add a pull-up resistor, but a 3.6 V HIGH can still be achieved with these code lines.

Is this signal from the Arduino also isolated?
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2265
  • Country: au
Re: SPI Issue working with the ADS8684
« Reply #13 on: January 23, 2025, 09:23:55 pm »
If you lower your SPI clock to 1MHz you have a better chance of checking the logic of the code and comms without signal corruption. Once you get it working at the lower frequency you can then up the frequency and deal with any signal corruption/timing issues with the confidence that at least the code is correct.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf