R41Z I2C compatibility with Raspberry Pi?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

R41Z I2C compatibility with Raspberry Pi?

1,241 Views
diegocomin
Contributor IV

Hello,

I have a setup, where a R41Z module is connected via I2C to my Raspberry Pi Zero. The R41Z acts as a slave and my Raspberry Pi Zero as the master. I put simple communications via I2C to transmit some frames and I realized that the R41Z modules only transmit all the caracters well with only 10kHz Speed Bus!!! How this can be possible??

If I increment the bus speed, for example at 100 kHz I attach here the frame of data I obtain:

pastedImage_1.png

If I increment the bus speed to 400 kHz (I2C standard speed) I obtain a horrible response to the R41Z:

pastedImage_2.png

I took a look to the I2C protocol with a protocol analyzer and the data are being sent correctly from the Raspberry Pi to the R41Z.

pastedImage_3.png

The R41Z can not interpret the I2C commands with more than 10 kHz. How can be it possible? How can I solve this issue.

Regards,

Diego Comín

Labels (1)
0 Kudos
4 Replies

1,059 Views
diegocomin
Contributor IV

estephania_martinez‌ Have you found any solution to the issue?

0 Kudos

1,059 Views
diegocomin
Contributor IV

Thr program base I used to make the communication is the frdmkw41z_wireless_examples_thread_router_eligible_device_freertos

0 Kudos

1,059 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

It is most likely that the issue you are seeing it's related to the implementation in the application layer. How are you doing it? 

Are you using the serial manager or the direct drivers?

Regards,

Estephania 

0 Kudos

1,059 Views
diegocomin
Contributor IV

Hello Estephania,

First of all thank you for your concern about the issue. As I said to perform my application I took as a baseline the "frdmkw41z_wireless_examples_thread_router_eligible_device_freertos" project. In this project I want to transmit data from my Raspberry Pi Zero to the R41Z module and viceversa. The R41Z module is the I2C slave so I initialize the I2C pins and the slave configuration as follows:

Defines of I2C:

pastedImage_1.png

I2C pins initialization:

pastedImage_2.png

I2C slave configuration:

pastedImage_3.png

I2C slave callback:

pastedImage_4.png

All I2C configuration and use is taken from the "frdmkw41z_driver_examples_i2c_interrupt_transfer" example project. I put a NVIC priority of the slave in my application to 6: NVIC_SetPriority(I2C_SLAVE_IRQ, 6);

I DO NOT USE SERIAL MANAGER I do not know if it is the way I should take but I did not find any documentation explaining how to carry the I2C operations with Serial Manager, I use I2C direct drivers (i2c interrupt transfer).

So if the R41Z module want to transmit data to the RPZ it is done inside a CoAP callback, in this CoAP callback I send to the RPZ a digital pin interrupt and in this moment the RPZ read to the R41Z 32 bytes of data that at 100 kHz it does not work correctly. 

Viceversa, if the RPZ want to transmit data to the R41Z periodically, the RPZ send a digital output that my R41Z takes as an interrupt, I put to the CoAP queue message a CoAP transmision function. In this function, I wait that the RPZ write 64 bytes of data to the R41Z in a for loop waiting for 64 g_SlaveCompletionFlags and finally, I send a CoAP POST with the frame of data (the images I posted of the incorrect frame of data received are from this operation).

I send here the code of the transmission from RPZ to the R41Z:

The input interrupt in the R41Z when I send a digital output with the Raspberry Pi Zero. (I put the APP_ReportAviso function to the CoAP messages queue).

pastedImage_10.png

The APP_ReportAviso function:

pastedImage_12.png

pastedImage_13.png

In this function I clean the I2C receive buffer and I wait 64 bytes of transfer with 64 g_slaveCompletionFlag. After that I print the frame of data received and I send a CoAP POST. Here I realize that my frame of data are not correctly transmited by I2C between Raspberry Pi Zero and R41Z. 

I do not know if you need more information about my application to solve the I2C transmission issue between RPZ and R41Z. I appreciate so much your help Estephania.

Regards,

Diego Comín

0 Kudos