I must use i2c bus of mod5270 but after try more more times i must ask you to help. I must have 4 analog input and i use Philips PCF8591 the schema is the same of link
http://foxlx.acmesystems.it/?id=10
The only change that i have apply is to add two pull-up resistors to SDA/SCL (4.7K value). the SDA is connected to j2-39 pin and SCL is connected to j2-42 pin.
The hardware is the same that i use in Rabbit module 2200 and working, in Netburner I can not read data bus. the source code of rabbit is the follow
int read_I2C(unsigned char address, char *buf, unsigned char len)
{
auto unsigned char cnt;
auto short int err;
i2c_stop_tx();
if (err=i2c_startw_tx()){
i2c_stop_tx();
return -1; }
if (err=i2c_wr_wait(0x90 | (address<<1))){
i2c_stop_tx();
return -1;
}
if (err=i2c_write_char(0x44)){
i2c_stop_tx();
return -1;
}
i2c_stop_tx();
if (err=i2c_startw_tx()) {
i2c_stop_tx();
return -1;
}
if (err=i2c_wr_wait(0x91 | (address<<1))){
i2c_stop_tx();
return -1;
}
i2c_read_char(&buf[cnt]);
i2c_send_ack();
for (cnt=0;cnt<len;cnt++)
{
err=i2c_read_char(&buf[cnt]);
if (err)
{
i2c_stop_tx();
return -1;
}
if (cnt==(len-1))
{
i2c_send_nak();
}
else
{
i2c_send_ack();
}
}
i2c_stop_tx();
return 1;
}
I have try to use the same code using I2CStart, I2CStop, I2CSend, I2CRead but not working, when i send 0x44 to databus i receive the I2C_NO_LINK_RX_ACK (9) error.
You can help me to develop the I2C bus reader for netburner?
Thank'you
Luca Borriero
Problem using I2C bus
Re: Problem using I2C bus
Luca,
use (well tested) NetBurner I2C library: chapter "12. I²C Library" of "The NetBurner Runtime Libraries User Manual".
See also the examples:
- C:\nburn\examples\mod5270\I2C2Serial
- C:\nburn\examples\mod5270\QSPI2Serial
use (well tested) NetBurner I2C library: chapter "12. I²C Library" of "The NetBurner Runtime Libraries User Manual".
See also the examples:
- C:\nburn\examples\mod5270\I2C2Serial
- C:\nburn\examples\mod5270\QSPI2Serial
Yevgeni Tunik
Embedded/RealTime software engineer
https://www.linkedin.com/in/yevgenitunik/
________________________
Embedded/RealTime software engineer
https://www.linkedin.com/in/yevgenitunik/
________________________
-
- Posts: 11
- Joined: Tue Jun 17, 2008 5:25 am
Re: Problem using I2C bus
Thank'you very much for your answer yevgenit, but i have readed the documentation several times and i try to use the sample I2c. If i use the sample i read from bus all 0xFF data. You think that is the hardware PCF8591 using 3.3V not working? I have try to remove the module 5270 from dev-board-70 and use UDPTerminal for debug the application, but not working.
Re: Problem using I2C bus
premiaware,
using digital scope is much more informative for hardware-to-software troubleshooting, than any debugger.
Check the levels and the timing of the QSPI-to-ADC signals. Are all the specification items satisfied?
Check presence of ACK bit from your ADC chip. If it is HIGH, something is wrong with addressing the chip.
If ACK bit is LOW, the chip is correctly addressed. In this case, verify, that the scope show the datasheet mentioned waveform.
If you have no a scope, verify the received ACK bit value by inspecting the related i2c module register with your debugger or with debug print.
>
using digital scope is much more informative for hardware-to-software troubleshooting, than any debugger.
Check the levels and the timing of the QSPI-to-ADC signals. Are all the specification items satisfied?
Check presence of ACK bit from your ADC chip. If it is HIGH, something is wrong with addressing the chip.
If ACK bit is LOW, the chip is correctly addressed. In this case, verify, that the scope show the datasheet mentioned waveform.
If you have no a scope, verify the received ACK bit value by inspecting the related i2c module register with your debugger or with debug print.
>
3.3V is OK for mcf5270 + Philips PCF8591.You think that is the hardware PCF8591 using 3.3V not working?
Yevgeni Tunik
Embedded/RealTime software engineer
https://www.linkedin.com/in/yevgenitunik/
________________________
Embedded/RealTime software engineer
https://www.linkedin.com/in/yevgenitunik/
________________________
Re: Problem using I2C bus
premiaware,
I have found a device called Logic from saleae.com to be very useful for I2C work. You can probe the clock and data lines, and it will show the waveforms and decode each byte to let you know what data you are sending and receiving. (I don't work for them.)
Sam
I have found a device called Logic from saleae.com to be very useful for I2C work. You can probe the clock and data lines, and it will show the waveforms and decode each byte to let you know what data you are sending and receiving. (I don't work for them.)
Sam