Wierd Analog to Digital Problem with MK20DX256VLH7

Status
Not open for further replies.

Loren42

Well-known member
I have the analog section set to 10 bits, but something strange is happening that I can't explain.

I have an analog input that I set to give an output via USB to approximately 2048. Now there is some noise at the input, so the output dithers about ±5 counts.

However, after running for a period of time I see a significant jump where the output is 2303 (0x8FF) or 1792 (0x700). The input noise isn't the issue. The jump is 256 counts.

That tells me that a most significant bit is either getting set or cleared when it shouldn't. At least that is how it manifests itself.

I thought the A to D was on a 16-bit data buss or is it 8 bits and the processor does multiple reads to get the data?

I can see the latter case as a possibility if the conversion takes place somehow between a read of the least significant byte and the most significant byte and if the input transitions from 2047 to 2048 (or vice versa).

Not saying that is what is happening, but it appears that way. Anyone has an idea why this happens?

Main.cpp included:
 

Attachments

  • main.cpp
    13.5 KB · Views: 35
Generic advice - keep simplifying the software until the problem goes away. So in this case, down to a single channel with no averaging.
 
Generic advice - keep simplifying the software until the problem goes away. So in this case, down to a single channel with no averaging.

Thanks for the reply. I'm having doubts it's the software being the culprit. I have two boards each connected via USB on a different Mac. One of the two boards consistently had this 255 count jump with one of the A2D channels, but the other did not.

So, this morning I swapped the two boards between the two Macs. Oddly enough, I got the same error, but on the board that was working fine. In other words, the problem stayed with the one Mac. It seems one of the two Macs may be the problem or the USB port extender is causing the issue.

So, the Teensy may be off the hook.
 
Status
Not open for further replies.
Back
Top