Weird behavior from ATSHA204A. High output is only 900mV. - Page 1
Forum section: electronics / general

author: meneerbeer
author_rank: Newbie
timestamp: June 23, 2019, 01:28:18 pm
content: I am having a weird issue with anATSHA204A. I am trying to communicate with it, but I cannot get it to work at all. I am using thesame schematicas 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?

author: rstofer
author_rank: Super Contributor
timestamp: June 23, 2019, 01:40:26 pm
content: Since you mentioned SDA, I assume I2CBoth 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.

author: meneerbeer
author_rank: Newbie
timestamp: June 23, 2019, 01:47:50 pm
content: I literally did provide the schematics.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.

author: Siwastaja
author_rank: Super Contributor
timestamp: June 23, 2019, 01:54:08 pm
content: 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: June 23, 2019, 02:00:47 pm
content: 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.)

author: meneerbeer
author_rank: Newbie
timestamp: June 23, 2019, 02:18:37 pm
content: Quote from: Siwastaja on June 23, 2019, 01:54:08 pmYes, 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.Quote from: SiliconWizard on June 23, 2019, 02:00:47 pmI 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: June 24, 2019, 12:32:25 pm
content: 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.

author: mikerj
author_rank: Super Contributor
timestamp: June 24, 2019, 05:21:37 pm
content: Quote from: meneerbeer on June 23, 2019, 02:18:37 pmThe 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?

author: meneerbeer
author_rank: Newbie
timestamp: June 24, 2019, 06:40:08 pm
content: Quote from: SiliconWizard on June 24, 2019, 12:32:25 pmI did a measurement with SDA disconnected and I get 720mV. I cannot do the single shot acquisition at the moment easily, unfortunately.Quote from: mikerj on June 24, 2019, 05:21:37 pmFair 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.