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

PSoC™ 4 Forum Discussions

GeFLo
Level 2
10 sign-ins 5 replies posted 5 questions asked
Level 2

Hello,

I have implemented the CY8C4147AXI-S455 on a board and use the I2C bus on pin 18,19 as a master. This master sends only command to a slave implemented on an Arduino mega board.  No read access are performed.  

The clock is 100kHz.  Pull-up resistors are 4,75k. Both boards are supplied with a common +5V. 

As long as I tested I2C messages  sent by the master without slave connexion I could see  proper signals on data and clock.  Of course NACK was detected. 

 

When I connect the arduino board, then no signal are detected : SCL is  forced to 0 and SDA forced to 1.  No clock and data activity. 

Then when I disconnect the arduino board, SCL remains permanently low and SDA high.  The bus does not work anymore.

Is the bus definitely out of order?  What happened? 

 

 

0 Likes
1 Solution
Hari
Moderator
Moderator 750 replies posted 500 replies posted 250 solutions authored
Moderator

Hi @GeFLo 

 

Previously, it was mentioned that when the slave was not connected, the master was sending the data. Is that not the case anymore? Are you still seeing the SCL line low and SDA set to 1 always?

 

Can you share your project that you are using so that we can try the same at our end?

 

Also note that if you receive the MSTR_BUS_BUSY, the solution is to reset the block by calling Stop and Start after the error is received. Restarting the I2C block at the beginning will not help in the MSTR_BUS_ERROR flag. 


Best regards, 
Hari

View solution in original post

0 Likes
5 Replies
Hari
Moderator
Moderator 750 replies posted 500 replies posted 250 solutions authored
Moderator

Hi @GeFLo 

 

Can you check the return status of the I2C component? Note that the component sets the busy flag in case the bus is not free during transmission and is only reset when the component is reset (or the bus is free). Please see this snippet from the component datasheet - 

Hari_0-1641874541204.png

 

 

Since we know that the I2C master is working independently, can you also check the configuration in Arduino? Note that if the Arduino pulls the SCL line low, then the PSoC master will not send the data, therefore, the configuration at Arduino must also be ensured for successful communication. 

 

Best regards, 
Hari

0 Likes
GeFLo
Level 2
10 sign-ins 5 replies posted 5 questions asked
Level 2

Hi Hari

I have added a 10 secondes delay before the PSOC performs the first write access to the Arduino I2C slave.  That way the Arduino is started and is waiting for incoming messages from the PSOC. The results are the following : 

  1. I saw that the MSTR_BUS_BUSY status is returned by the MasterSendStart call, at the begining of the I2C write access to the Arduino I2Cslave .
  2. So I added  Stop() and Start() before the I2C write access, but the MSTR_BUS_BUSY status is still returned by the MasterSendStart call.
  3. I tested the bus with no slave connected . I checked with the oscilloscope the SDA and SCL signals. SCL is  forced to 0 and SDA forced to 1.  No clock and data activity.  I was expecting activity due to MasterSendStart call.  The MSTR_BUS_BUSY status is still returned by the MasterSendStart call. 
  4. I have tried several times and got the same result.
  5. I checked that the I2C slave Arduino works well when connected to an I2C master Arduino.

I am afraid that the bus is  irrevocably out of order.  It may be because during the first tries, the first write access from the PSOC was performed while the arduino was starting. Then the SDA and SCL drivers might have been electrically forced  and destroyed. Do you think it might be possible? What else can I do?

Best Regards

Gérard

 

0 Likes
Hari
Moderator
Moderator 750 replies posted 500 replies posted 250 solutions authored
Moderator

Hi @GeFLo 

 

Previously, it was mentioned that when the slave was not connected, the master was sending the data. Is that not the case anymore? Are you still seeing the SCL line low and SDA set to 1 always?

 

Can you share your project that you are using so that we can try the same at our end?

 

Also note that if you receive the MSTR_BUS_BUSY, the solution is to reset the block by calling Stop and Start after the error is received. Restarting the I2C block at the beginning will not help in the MSTR_BUS_ERROR flag. 


Best regards, 
Hari

0 Likes
GeFLo
Level 2
10 sign-ins 5 replies posted 5 questions asked
Level 2

Hello Hari,

I have tested the software with a 10 seconde delay before the PSOC performs the first write access to the Arduino I2C slave, on new boards which have never been powered up previously.  There is no problem on these boards, the bus operates normally.

But the same program on boards which previously didn't work, are still out of order.  SCL is permanently low and SDA high.  So I think that I2C bus is  definitively out of order, but I don't understand what happened.

Best regards

Gérard

0 Likes
Hari
Moderator
Moderator 750 replies posted 500 replies posted 250 solutions authored
Moderator

Hi @GeFLo 

 

Can you let me know the failure rate of the boards? How many boards are failing with this issue?

Since there are boards that are working, this is likely caused due to some board issue. Can you try to swap the controllers from the good and bad boards and see if the issue is still present?

 

Best regards, 
Hari

0 Likes