2
\$\begingroup\$

I am simulating a master-slave scenario. The master is the PIC18F4620, the slave is the I2C debugger.

I am sending a slave address of 0x04. R/W = 0 to perform a write operation on the slave.

This is my frame format.

        //Slave address is 0x04.
        mcal_i2c_send_slave_address(0x04,0,&ack_status);
        //Send data = 0x77
        mcal_i2c_master_send_data(0x77,&ack_status);
        //send repeated start
        mcal_i2c_send_repeated_start_condition();
        //send data = 0x00 , then send stop condition.
        mcal_i2c_master_send_data(0x00,&ack_status);
        mcal_i2c_send_stop_condition();

The transmitter which is the PIC18F is transmitting the frame correctly. The problem is that the I2C debugger won`t send ACK, it only sends NOT ACK.

Does anybody know why I am receiving NACK from the I2C debugger?

enter image description here

\$\endgroup\$
3
  • 1
    \$\begingroup\$ A debugger is not intended to be an active participant on the bus, it is only there to monitor the interaction between the controller and the appication device(s). \$\endgroup\$
    – Dave Tweed
    Sep 25, 2022 at 19:38
  • \$\begingroup\$ I see video tutorials on youtube that the debugger responds with ACK \$\endgroup\$ Sep 25, 2022 at 20:35
  • \$\begingroup\$ Maybe some debuggers can be put into a "device emulation" mode. Relatively straightforward to do for generic devices like memories; it'd be much more difficult to do the broader range of I2C sensors and other devices. \$\endgroup\$
    – Dave Tweed
    Sep 25, 2022 at 21:04

2 Answers 2

1
\$\begingroup\$

The debugger just monitors bus activity and logs it. It doesn't transmit anything on the bus itself, it just records what other devices transmit.

So the debugger's not transmitting a NACK or transmitting anything. A NACK is just SDA left pulled high during that bit period and detecting no bus activity looks the same as detecting a NACK.

\$\endgroup\$
0
\$\begingroup\$

The waveform sends start and 0x00, so if that is not a valid device address then no device sends ACK.

Note that there is no ACK for the byte 0x77 either.

\$\endgroup\$
5
  • \$\begingroup\$ The waveform shown is just a screenshot. \$\endgroup\$ Sep 25, 2022 at 19:56
  • \$\begingroup\$ Yes, I am aware of that. Screenshot or not, the I2C protocol is still wrong. There is no address sent after start. \$\endgroup\$
    – Justme
    Sep 25, 2022 at 20:00
  • 1
    \$\begingroup\$ In the code snippet i sent 0x04 as the slave address, it is sent but i didn't take a screenshot of it on the waveform \$\endgroup\$ Sep 25, 2022 at 20:02
  • \$\begingroup\$ It is although shown on the i2c debugger widnow \$\endgroup\$ Sep 25, 2022 at 20:03
  • \$\begingroup\$ @MuhammedElmaghraby The "Sr 00" confirms it's wrong. Anyway, that's a separate problem, if you don't have anything on bus that would ACK an address. \$\endgroup\$
    – Justme
    Sep 25, 2022 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.