I2C Master ending up in ASSERT in IRQ routine

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Trying to get an I2C Master working in the Dev Kit but running into issues.

When trying to use the I2C Master I end up in an ASSERT in the IRQ routine if the module is set to "Fixed Function".

Seems I end up in a condition that should never happen (No ACK, no NACK).

               if(I2C_CHECK_ADDR_ACK(tmpCsr))

                {

...

                }

                /* Address is NACKed */

                else if(I2C_CHECK_ADDR_NAK(tmpCsr))

                {

...

                }

                else

                {

                    /* Address phase is not set for some reason: error */

                    #if(I2C_TIMEOUT_ENABLED)

                        /* Exit interrupt to take chance for timeout timer to handle this case */

                        I2C_DisableInt();

                        I2C_ClearPendingInt();

                    #else

                        /* Block execution flow: unexpected condition */

                        CYASSERT(0u != 0u);

                    #endif /* (I2C_TIMEOUT_ENABLED) */

                }

On the pins I see 8 CLK's but never anything on the data line.

If I switch the module to UDB I don't end up in the assert but an endless loop in main.c waiting for the Transfer to complete.

There's nothing else in this project just the I2C master and a little bit of code to push out data.

Using Creator 4.1. (Sample Project Attached.)

Pull-Ups are attached, same behavior with I2C slave attached or not....

I would expect to see the device address to be pushed out in any case so this is very strange.

Anybody got any ideas?

Thanks,

Michael

0 Likes
1 Solution
Anonymous
Not applicable

Argghh...

SDA was shortened on my board to Vcc.....

And as it's connected via wires to the uC board changing the pins had no effect.

Explains the strange behavior, everything working now....

Michael

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Better check for I2C_MSTAT_WR_CMPLT instead of using I2C_MSTAT_XFER_INP.

Bob

0 Likes
Anonymous
Not applicable

Same result in Fixed function mode.

In UDB mode I do no longer hang in the "while" loop but also no data on the i2c bus.

Same result with one of the demo projects.

Relocated the Pins to P1_6/P1_7 for testing and now in UDB mode I get a I2C_MSTR_NOT_READY error on the MasterWriteBuf function both in fixed function and UDB mode. Nothing at all happens on the pins.

Pin allocation should not matter as this is not a slave, correct?

Michael

0 Likes
Anonymous
Not applicable

Argghh...

SDA was shortened on my board to Vcc.....

And as it's connected via wires to the uC board changing the pins had no effect.

Explains the strange behavior, everything working now....

Michael

0 Likes