Using I2C with Hsersetup background receive

cfarr

Member
I am wondering if hardware background receive fuctions correctly when used with Hi2c.

I have an 08M running at 8MHz listening happily to a 433MHz receiver. This captures the data and sends it approximately at 1 second intervals to a 40X1 running at 16MHz, via automatic serial backgrond receive. The data is extracted from the scratchpad, decoded and displayed on an LCD. This works perfect until I added a DS1307 RTC on the I2C bus which updates the LCD to 1 second resolution. I now find that the 40X1 (Version A.3 firmware with 5.2.9 editor) occasionally resets with the result that it either corrupts the DS1307 or returns ?? ?? ?? from the RTC. The 40X1 was substituted by a 40X2 (Version B.0 firmware with 5.2.9 editor) but with the same results.

Removing physically the background serial receive from the 40X1 clears the problem and the I2C works as expected. I tried slowing the micros, buadrates and the I2C bus but to no avail. Slowing the serial data from the 08M to the 40X1 seems (although I think, it is not all that reliable) to improve the situation but this reduces the speed drastically.

While waiting for any comments, I really want to thank all the people who help in this forum.
 

Technical

Technical Support
Staff member
Mixing interrupt orientated protocols can always be tricky and they can clash at the wrong times. One solution could be to software 'disable' the background serial during the i2c section of code.

Another simpler option may be to connect a spare pin on the X2 directly to the hserin pin (make sure there is a 1k resistor going off to the 08M). Then by making this pin an input it has no affect on the system. Making this pin an output low (or high depending on the polarity used) effectively pulls the hserin pin low (or high) regardless of what the 08M is doing. Therefore the sequence would be

low pin (or high pin)
(i2c stuff)
input pin

This effectively is the same as physically removing the background serial receive, which you have proved already works.
 
Top