Status: Accepted
Owner: [email protected]
CC: jsuijs
Labels: Type-Defect Priority-Medium
New issue 120 by [email protected]: I2C, recieve correct data when it
should be incorrect data.
http://code.google.com/p/jallib/issues/detail?id=120
Recently while working on I2c echo and servo lib, I have found a
possible bug and I am able to re-produce this.
After writing i2c_sw_master_echo and i2c_hw_slave_echo to two PIC's,
and also changing the forever loop at the bottom of sw_master_echo to
this:
for 50_000 loop
pc_char = "A"
-- transmit to slave
-- we want to send 1 byte, and receive 1 from the slave
i2c_tx_buffer[0] = pc_char
var bit _trash = i2c_send_receive(icaddress, 1, 1)
-- receive buffer should contain our result
ic_char = i2c_rx_buffer[0]
serial_hw_write(ic_char) ;send recieved "B" to pc
end loop
I do get the expected result, which is 50_000 B's.
Then, if I completely erase the slave PIC, or if slave PIC is not working
correctly but has power, and do a reset of the master via CTS line (no
power off reset), I get the same result!
I was receiving correct data when I should have gotten incorrect data.
I use the -no-variable-reuse compiler option. I'm guessing there is a
byte somewhere in I2C that should get reset to 0 before receiving data
from the slave.
Step-by-step fault reproduction
1. get I2C working with I2C sw master and I2C hw slave echo samples.
2. replace the forever loop with the above code, it will still work & send
data via serial port with master as it should.
3. erase slave PIC via ICSP
4. reset master PIC via CTS
5. It will still work & send data via serial port on master, but it should
not!
master - 18f4620, bootloader
slave - 18f452, ICSP port
discussion is here:
http://groups.google.com/group/jallib/browse_thread/thread/4f86add865fd0347/07af1060520e7b47#07af1060520e7b47
Matt.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.