Does i2c slave data exchange conflict with readtemp?

I think i2c slave mode data exchange on a 20x2 conflicts with readtemp. Does anyone know is that correct?

My 20x2 program regularly does a readtemp. Asynchronously it may also receive a message from an i2c master and sometimes the i2c message is reported by the master as 'failed'. This failure does not happen if I disable the readtemp instruction.
I see from the Manual 2 (page 267) that interrupts can conflict with 1-wire operations but I have no interrupts specifically enabled. Otherwise I believe the documentation is silent on possible conflicts?

Aside from the documentation and assuming the source of the conflict is as I describe, is there a way around this? The cause of the difficulty is that the i2c master (a Raspberry-Pi) needs to send out a one time urgent message just prior to its own shutdown - when there is little guaranteed time for protracted negotiation.
 

hippy

Technical Support
Staff member
One solution may be to use the OWIN and OWOUT commands so the PICAXE doesn't have to wait for the sensor to respond during which time the PICAXE may not be able to respond to I2C commands.
 

Goeytex

Senior Member
Sounds like a conflict to me.

Have a look at Picaxe Manual 2 Appendix 4. That is all that is published in regards to conflicts.

Can the Pi code be modified to use a different method to signal its impending shutdown to the Picaxe or are you stuck with what you have ?
 
Thanks everyone. After sleeping on it I realised that the manual was already telling me that the readtemp command automatically drops the frequency down to 4Mhz, so I think that is maybe one problem area. Dropping the RPi i2c baudrate down as low as 8000 I can't get it to talk to a 20x2 running permanently at 4Mhz.

Hippy's solution idea is interesting as I have never investigated the OWIN/OWOUT commands. The examples in the manual are directly relevant except that I think I would need to ditch the 'pause 750' and replace it with a revisit based on my 1 sec program timer cycle. But even then wouldn't the 20x2 speed still need to be down at 4Mhz, bringing me back to the speed issue above?

Goeytex suggests using another signalling method and, since I do have one spare 20x2 pin, I could have the RPi use a GPIO output to flag the shutdown. For no really good reason, except that it was yet another signal path and more complexity, I wanted to avoid that solution.

Another way round this would be to drop the digital temperature sensor and just use a thermistor, which would be simpler all round. I cannot see anything in the manual about potential conflicts with the readadc instruction.

Of course I knew about this little problem sometime ago but left it with a work around - and then failed to properly check my notes before commissioning the 1st pcb print. I can live with it for the present but want to get it fixed for the next iteration.
 
Top