Author Topic: Weird behavior from ATSHA204A. High output is only 900mV.  (Read 1465 times)

0 Members and 1 Guest are viewing this topic.

Offline meneerbeerTopic starter

  • Newbie
  • Posts: 6
  • Country: nl
Weird behavior from ATSHA204A. High output is only 900mV.
« on: June 23, 2019, 01:28:18 pm »
I am having a weird issue with an ATSHA204A. I am trying to communicate with it, but I cannot get it to work at all. I am using the same schematic as Sparkfun. The only difference is that I am using a 4.7K pull-up, which should not matter.

I took a look at the SDA signal using an oscilloscope and it seems that whenever I drive a high value to it, it only reaches around 900mV, rather than the expected 3.3V. I have no clue why this is happening. I have tried to interface with it using an Arduino and an FPGA and in both cases I only get 900mV when I drive SDA high. At this point I have tried 4 different ATSHA204A devices, but I always observe this 900mV problem.

Does anyone have any idea why this could be happening?
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #1 on: June 23, 2019, 01:40:26 pm »
Since you mentioned SDA, I assume I2C

Both the clock and data lines are open collector/drain and the high level is provided only by the pull-up resistors.  If the high voltage isn't high enough, something is loading down the lines.  You didn't provide a schematic so there's no way of telling whether you accidentally created a voltage divider.  Something isn't configured right.

Do be careful when selecting the pull-up resistor.  4.7k might work on a single PCB with limited capacitance and short runs.  You can Google for the NXP I2C specification document.  There is a large discussion re: selecting the resistor.  Sometimes 10k works, 2.2k almost always works.
 

Offline meneerbeerTopic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #2 on: June 23, 2019, 01:47:50 pm »
I literally did provide the schematics.  ;D

I am using the 3-pin version of the ATSHA204A, which uses a single-wire protocol through a pin called SDA. Indeed the SDA output is also open-collector. I have tried 1KOhm before, but I had the same issue. :(
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8180
  • Country: fi
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #3 on: June 23, 2019, 01:54:08 pm »
Have you looked at the obvious, measured the presence of correct Vcc directly off the pin?

You mention you have tested several pullup values. Always the exact same 900mV? If not, this could be a tip of what's happening.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #4 on: June 23, 2019, 02:00:47 pm »
The datasheet is not crystal-clear about driving the SDA signal in single-wire mode, but also looking at the library (on github), I'd venture that you need to use a totem-pole configuration on the MCU side, and not an open-drain one (as opposed to what you would do in I2C mode...) Obviously you have to handle the bus turnaround properly (switching the MCU port to output or input depending on the stage of the communication).

Maybe take a look at this for some ideas: https://github.com/sparkfun/SparkFun_ATSHA204_Arduino_Library/blob/V_1.0.0/src/sha204_library.cpp

(Using the I2C mode (with the package supporting it) would probably be easier, especially if you have other I2C peripherals on the same board.)
 

Offline meneerbeerTopic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #5 on: June 23, 2019, 02:18:37 pm »
Have you looked at the obvious, measured the presence of correct Vcc directly off the pin?

You mention you have tested several pullup values. Always the exact same 900mV? If not, this could be a tip of what's happening.
Yes, I measured the Vcc pin and that gives the correct 3.3V.

I just compared my FPGA (uses 10K resistor) and the Arduino (4.7K resistor). The high voltage is for both 900mV. There may be a slight difference, but that is difficult to see on the scope.

The datasheet is not crystal-clear about driving the SDA signal in single-wire mode, but also looking at the library (on github), I'd venture that you need to use a totem-pole configuration on the MCU side, and not an open-drain one (as opposed to what you would do in I2C mode...) Obviously you have to handle the bus turnaround properly (switching the MCU port to output or input depending on the stage of the communication).

Maybe take a look at this for some ideas: https://github.com/sparkfun/SparkFun_ATSHA204_Arduino_Library/blob/V_1.0.0/src/sha204_library.cpp

(Using the I2C mode (with the package supporting it) would probably be easier, especially if you have other I2C peripherals on the same board.)
I am actually trying that code on the Arduino. Unfortunately already during the starting wakeup routine I get weird results. The wakeup routine basically means that you have to pull the input low for ~60us and then high for 2.5ms. Unfortunately, when I pull the input high I once again only measure 900mV.. Only pulling the line high, no wakeup routine also gives 900mV..

So basically it seems I cannot drive the line high enough for it to be registered as a high value by the ATSHA204A meaning I will not be able to communicate to it.
« Last Edit: June 23, 2019, 02:21:00 pm by meneerbeer »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #6 on: June 24, 2019, 12:32:25 pm »
Sounds odd. If the voltage you're measuring is consistantly 900mV regardless of the pull-up, that could mean that the MCU's IO is indeed driven high as a totem-pole output (and not as open drain), and the SDA line of the ATSHA204A is forcing it low. Have you tried looking at the SDA pin of the ATSHA204A while it's powered BUT SDA disconnected from the MCU? Is it then still low? You could issue a single shot acquisition triggered on Vcc when you're powering it on to see what's happening.

 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #7 on: June 24, 2019, 05:21:37 pm »
The wakeup routine basically means that you have to pull the input low for ~60us and then high for 2.5ms.

The single wire "wake" token has 8 consecutive low bits, including the start bit.  At the required 230.4 kbaud rate that only provides a 34.7us low pulse, so what am I missing?
 

Offline meneerbeerTopic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: Weird behavior from ATSHA204A. High output is only 900mV.
« Reply #8 on: June 24, 2019, 06:40:08 pm »
Sounds odd. If the voltage you're measuring is consistantly 900mV regardless of the pull-up, that could mean that the MCU's IO is indeed driven high as a totem-pole output (and not as open drain), and the SDA line of the ATSHA204A is forcing it low. Have you tried looking at the SDA pin of the ATSHA204A while it's powered BUT SDA disconnected from the MCU? Is it then still low? You could issue a single shot acquisition triggered on Vcc when you're powering it on to see what's happening.
I did a measurement with SDA disconnected and I get 720mV. I cannot do the single shot acquisition at the moment easily, unfortunately.

The wakeup routine basically means that you have to pull the input low for ~60us and then high for 2.5ms.

The single wire "wake" token has 8 consecutive low bits, including the start bit.  At the required 230.4 kbaud rate that only provides a 34.7us low pulse, so what am I missing?
Fair point, but the datasheet mentions this:

"The Wake token is special in that it requires an extra long low pulse of tWLO on the SDA pin (see Table AC Parameters – All I/O Interfaces), which cannot be confused with the shorter low pulses that occurduring a Data token (Zero, One, ZeroOut, or OneOut). "

According to the mentioned table the minimum time is 60us. I have tried different durations up to 100us at this point. The datasheet seems to suggest that the pulse can be longer than 60us.

One very far fetched thing I am thinking what could still be the case is that initially the ATSHA204A is working but loses sync at some point somehow. In that case I would expect to see full voltage swings though, which my logic analyzer should be able to pick up.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf