Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software crashes on 5V boards #5

Closed
daan03er opened this issue Mar 14, 2024 · 22 comments
Closed

Software crashes on 5V boards #5

daan03er opened this issue Mar 14, 2024 · 22 comments

Comments

@daan03er
Copy link

When running the every example code, the software crashes after around 10 seconds. The reset and power on and off does not reinstate de measurements, only reuploading the code makes sure that the software starts running again. However, crashes again after 10 seconds.

I have the internal I2C pullup resistors disabled and replaced with external 5K ohm resistors. The GND, 5V and address pins are all connected correctly. I am not using the data ready pin.

The IN1 is connected to ground and IN0 is connected to my analog signal.

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

Hi @daan03er ,

I don't have a Leonardo, so I can't fully replicate what you are seeing. I will try running it on a 5V ATmega328P board, just to see if it demonstrates the same issue.

I suspect this is something to do with either the Leonardo, or your set-up. But, from your description, you seem to be doing what I would do.

  • Does the example crash if you disconnect the analog signal?
  • Does it crash if you disconnect IN1 from ground - and use myADC.setInputMultiplexer(ADS1219_CONFIG_MUX_SINGLE_0); ?
  • Is your signal going higher than 5V?
  • Or lower than 0V?

Best,
Paul

@daan03er
Copy link
Author

Hi Paul,

Yes, the crash still occurs when the analog signal is disconnected. It is however after a longer periode of time compared to when the analog signal is connected.

When i set myADC.setInputMultiplexer(ADS1219_CONFIG_MUX_SINGLE_0) it does not crash when the analog signal is disconnected, when it is connected it does crash.

No, the signal is set on 1.5V

@daan03er
Copy link
Author

Nevermind, it just crashed

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

I've got the example running on a 5V ATmega328P. No crashing. Everything is working.

Please share a photo of your board, and the wires linking them.

I wonder if this is something to do with I2C clock stretching? I know the Due does not support clock stretching. Maybe the Leonardo has the same issue?

Thank you,.
Paul

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

Oh. Hang on... My board just crashed...!

Investigating...

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

OK. I think this has something to do with the reference voltage. I just tried the following and it seems to have fixed the issue:

  • Connect REFP to VDDA - the pins are adjacent on the SparkX PCB
  • Connect REFN to GND - ditto
  • Open Example6
  • Change this line to:

float milliVolts = myADC.getConversionMillivolts(5000.0); // Convert to millivolts - using a reference of 5000mV

Let me know if this fixes the issue on Leonardo too.

Thanks,
Paul

@PaulZC PaulZC changed the title Software crashes with Arduino Leonardo Software crashes on 5V boards Mar 14, 2024
@daan03er
Copy link
Author

This does seems to be working, the program has been running for a minute now, gonna keep it running longer.

Do you have any idea what the issue is/was exactly?

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

Not exactly... The internal reference is 2.048V. Maybe the chip doesn't like common mode voltages well outside that? Just a guess... But it does seem to have fixed it.

I'm going to close this as I think we have resolved the issue - and that it's nothing to do with the library. But I will pin it, to make it easier to find.

Please reopen if you see more weirdness...

All the best,
Paul

@PaulZC PaulZC closed this as completed Mar 14, 2024
@PaulZC PaulZC pinned this issue Mar 14, 2024
@daan03er
Copy link
Author

I think it just crashed after 8 minutes....

Running again now

@daan03er
Copy link
Author

Yes, just stopped again.

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

OK. Mine's still running... I'm not sure what else to suggest...?

Maybe double-check those pull-ups? Are you able to put a 'scope or logic analyzer on the SDA and SCL lines?

Or, are you able to test it on a 3.3V board - just to confirm that voltage is the critical issue?

@daan03er
Copy link
Author

I'll put a scope and the SDA and SCL pins.

I dont have a 3v3 board.

@daan03er
Copy link
Author

Hi Paul,

After furter investigation, the crash occurs in the following part:
afbeelding
I do get the serial message: "dataready reg thing".
However, after this it crashes. It happens after 10-15 minutes so I am very puzzeled.

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

Hi @daan03er ,

That line of code is just a standard Wire register read. The actual read is done by the Toolkit.

I really don't understand why the read is crashing...

Are you powering the ADS1219 directly from 5V? And pulling up SCL and SDA to 5V also?

Please post a photo of your boards and the connections between them. It always helps...

Best wishes,
Paul

@daan03er
Copy link
Author

WhatsApp Image 2024-03-14 at 11 44 28

The ADS1219 is supplied with 5V and the I2C pullups are also to 5V.

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

Another little trick is to put Serial.flush(); after each debug print. That way the code will wait until the serial data has actually been sent before it moves on. Then you can be absolutely sure where the crash is happening. The crash may be happening a little later, before the message is actually printed.

Thanks for the photo. Taking a look now.

@daan03er
Copy link
Author

I connected the ADS1219 to 3v3 as power and now it has been working for over 20 minutes.

@daan03er
Copy link
Author

Could it be that at 3v3 the I2C pullup resistors work better then at 5V? Right now I have 5Kohm pullup resistors.

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

Your circuit looks OK. I can't see anything wrong... Except I can't make out your resistor values. 5K should be Green Black Red. Or Green Black Black Brown. They look like 500 Ohm: Green Black Black Black?

@daan03er
Copy link
Author

I measured them to be sure and they are 5K.

@daan03er
Copy link
Author

It seems to be working stable at 3v3. Been running for 1 hour now.

@PaulZC
Copy link
Collaborator

PaulZC commented Mar 14, 2024

That's good. I'm pleased it is working.

Some decoupling capacitors may help. I suggest adding 2.2uF and 0.1uF close to the AVDD and DVDD pins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants