|
|
View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19477
|
|
Posted: Tue Feb 04, 2020 1:42 am |
|
|
Good.
It's actually potentially 'interesting'. In the PIC, interrupts are only responded
to in the first sub state of the instruction. So anything that results in
an instruction 'not terminating' can prevent interrupt handling.
Now have found references that MicroChip have two different internal
state machines used to handle the I2C master. On one if the slave
holds SCL, the master state machine actually stops inside the transmitting
instruction. When I found this, what had to be happening became 'clear'.
Not good, really a fault with how the I2C hardware is implemented on the
PIC. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Tue Feb 04, 2020 3:09 am |
|
|
Hi Ttelmah
You wrote:
Quote: | ... if the slave
holds SCL, the master state machine actually stops inside the transmitting
instruction. |
It means that if it happens, a safety procedure like WDT or a timer counting for time and interrupts will not work?
It mean that is not safe to use I2C on PIC?
Maybe have to make a safety procedure in the Slave?
I am resetting the WDT just in main and DWT is set to 16ms also in the Master and in the Slave.
If the WDT was resetting, I was getting errors. As I understand from what you wrote, this what happened when the I2C was Slow=50000.
I understand correct?
Best wishes
Joe |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19477
|
|
Posted: Tue Feb 04, 2020 4:20 am |
|
|
The watchdog _will_reset the machine (it is independant of the processor
itself), but the timer counter will not (since the processor is effectively
stopped 'inside' an instruction).
It also won't happen if you can use DMA for this transfer (since then it
is the DMA controller, not the processor kernel itself that is performing
the operation.
However, just use software. For a master, at reasonable clock rates,
software I2C is as fast, and has far fewer issues. One of these things
where the MicroChip hardware is not actually that well designed.... |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Tue Feb 04, 2020 7:22 pm |
|
|
Thank you Ttelmah
I remain with the WDT enabled at 16ms in the Master and the Slave.
Best wishes
Joe |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|