Questions and discussions about the software that runs on the TD RF module itself.
Siemen
 
Posts: 2
Joined: Fri Jul 08, 2016 8:47 am

TD1208 I2C issue after power cycle

by Siemen Wed Aug 17, 2016 2:15 pm

Hello,

I have an issue using the TD1208 when I am reading sensor values via I2C.
Everything works perfect when I flash the firmware (which includes a reset via the reset pin).

However, when I power cycle the device (disconnect wires for power and reconnect), the program does not run properly.
On the scope, the SCL and SDA lines both suddenly return from low (pulled down) to high (released).
Depending on slight changes in the code, this moment occurs in the somewhere during the sending of the device I2C bus address.
In my last test, this was during the 6th clock cycle.

Does anyone have a similar issue like this (different I2C behaviour for power cycle vs reset pin toggle)?
User avatar
mstempin
 
Posts: 168
Joined: Thu May 07, 2015 9:24 am

Re: TD1208 I2C issue after power cycle

by mstempin Wed Aug 24, 2016 9:18 am

No, but I had issues in the past with I2C because of an undocumented trick within EnergyMicro's I2C implemetnation of the I2C in "lib/emlib/em_i2c.c": the "I2C_TypeDef *" passed to the "I2C_Transfer()" function must be static, within the caller's code, as it contains the Finite State Automaton current state.

If the I2C_TypeDef structure is allocated in the caller's stack as a dynamic structure, you get what is left in memory between stack calls, i.e. garbage. This mays explain why it is working when you Flash for the first time and when you reboot the device.
Return to Firmware

Who is online

Users browsing this forum: No registered users and 30 guests