I2C Issues

19 views
Skip to first unread message

mattschinkel

unread,
Mar 1, 2010, 1:29:06 PM3/1/10
to jallib
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. I can send the
entire code if needed.

Then, if I completely erase the slave PIC, and do a reset of the
master via CTS line (no power off reset), I get the same result!

Because of this, I had previously thought my servo lib was working
correctly with I2C. I was recieving correct data when I should have
gotten incorrect data. I need to do more testing with servo + I2C
slave.

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 recieving data
from the slave.

Matt.

Joep Suijs

unread,
Mar 17, 2010, 2:09:19 PM3/17/10
to jal...@googlegroups.com
Hi Matt,

What is the status of this possible bug?

Joep

2010/3/1 mattschinkel <mattsc...@hotmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "jallib" group.
> To post to this group, send email to jal...@googlegroups.com.
> To unsubscribe from this group, send email to jallib+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
>
>

mattschinkel

unread,
Mar 17, 2010, 4:04:15 PM3/17/10
to jallib
Hi Joep, thanks for following up.

I don't know much about the I2C libs, so I am unable to fix the issue.
Nothing has changed. Should I add an issue?

My fix was to send "A" then "C" and loop so I would get back "B" &
"D", or to just do power-off reset every time. This is not a proper
fix.

In the example I have shown, I think I should have gotten some error
or just 0xFF if data was not sent/received correctly. Instead, as I
stated, I got the correct result.

Matt.

On Mar 17, 11:09 am, Joep Suijs <jsu...@gmail.com> wrote:
> Hi Matt,
>
> What is the status of this possible bug?
>
> Joep
>

> 2010/3/1 mattschinkel <mattschin...@hotmail.com>:

Joep Suijs

unread,
Mar 17, 2010, 4:44:34 PM3/17/10
to jal...@googlegroups.com
2010/3/17 mattschinkel <mattsc...@hotmail.com>:

> Hi Joep, thanks for following up.
>
> I don't know much about the I2C libs, so I am unable to fix the issue.
> Nothing has changed. Should I add an issue?
Yes please.
And please describe in more detail what source you use, what configuration.

Joep

Mike@watty

unread,
Mar 17, 2010, 4:59:48 PM3/17/10
to jallib
I was hoping to get working on I2C today...

There are basically 3 versions needed I think.
1) Normal 100kHz, 400kHz and 1MHz with 8 bit address apart from
address bits in control word.
2) Enhanced 100kHz, 400kHz and 1MHz with 16 bit address apart from
address bits in control word.
3) Slow I2C. maybe 300Hz to 1kHz. with 8 bit address apart from
address bits in control word.

Additionally the control word address may be device specific or set by
1 or more external pins.

I have the following I2C devices to test:
1) 24LC256, 24LC512
2) various small 24LCxx, UV916 and UV917 tuners. Comtech 1.2GHz TX
and RX (plessey synth?), National LMX2430 dual PLL/ dual synth
3) MRDS192 RDS encoder chip.

I will be testing / rewriting the HW and SW libraries on maybe 16F628,
maybe 16F877A and definitely 18F4550. I have some other PICs, but I
haven't time.

Current state of project showing that my libraries are working..:
http://www.techtir.ie/forums/showthread.php?p=4121#post4121
The CatPad will have a 6 pin mini-Din and menu to select various
external devices such as I2C synth controlled TX/RX, TTL serial GPS,
aerial tuner (strange 2 wire protocol that will run on I2C wiring) and
other gadgets.
Internally it uses 24LC512 for memories stored in BCD.

I have a different project that uses RDS encoder hooked to iTrip, PC,
SatTuners and 433MHz ASK/OOK receiver. Handset is FM radio controlled
by PIC with 433MHz ASK/OOK transmitter 1200bps to PC PIC server end
( connect to PC via USB and remote control WinAmp, Sat Tuner etc). FM
radio used to listen to PC/Tuner and receive both MP3tags/now-next via
RDS, but also the PIC and keypad /GLCD has two way comms with PC via
433MHz ASK/OOK TX and RDS user defined message.
Lots of different I2C stuff. Handset RDS decoding via PIC and JAL.


Mike@watty

unread,
Mar 17, 2010, 6:31:07 PM3/17/10
to jallib

On Mar 17, 8:04 pm, mattschinkel <mattschin...@hotmail.com> wrote:
> Hi Joep, thanks for following up.
>
> I don't know much about the I2C libs, so I am unable to fix the issue.
> Nothing has changed. Should I add an issue?
>
> My fix was to send "A" then "C" and loop so I would get back "B" &
> "D", or to just do power-off reset every time. This is not a proper
> fix.
>
> In the example I have shown, I think I should have gotten some error
> or just 0xFF if data was not sent/received correctly. Instead, as I
> stated, I got the correct result.
>
> Matt.

http://tech.groups.yahoo.com/group/jallist/message/28313

This is very neat Matt.

I will 1st thing tomorrow see If I can make the 256 byte RDS carousel
in the I2C encoder (0 to 600Hz *ONLY* I2C speed) and the 64Kbyte
24LC512 look like local arrays.
I also have a PCF8593 clock and PCF8574 8bit port.
I have military radios with 6 BCD decade switches = 3 x PCF8574 to
control from PIC and thus USB + serial...

Reply all
Reply to author
Forward
0 new messages