FLEXIO I2C Read Porblem

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

FLEXIO I2C Read Porblem

Jump to solution
2,355 Views
Proton_Dev
Contributor II

Hello Everyone,

 

I am using FELXIO I2C to read the data from device and I am using default example of I2c_polling_b2b_transfer example_master example. But I am not able to read from the device, I have set the correct address of device,pins and clock . Is there anything else has to be set into the structures of shifters and timers for that. I am attaching the default example. Any lead will be helpfull.

0 Kudos
Reply
1 Solution
2,318 Views
kef2
Senior Contributor V

Hi @Proton_Dev ,

 

FlexIO is nice thing, but it has its limits. Try with shorter messages. You code tries to send 33 bytes, while Processor Expert generated code specifies this

#define FLEXIO_I2C_MAX_SIZE (((uint32_t)((0xFFU - 1U) / 18U)) - 1U)

, which evaluates to 13 bytes. I faced the same problem with some I2C chip, which just can't be used due protocol limitations with FlexIO. I had to use dedicated I2C peripheral.

Edward

 

 

 

View solution in original post

5 Replies
2,319 Views
kef2
Senior Contributor V

Hi @Proton_Dev ,

 

FlexIO is nice thing, but it has its limits. Try with shorter messages. You code tries to send 33 bytes, while Processor Expert generated code specifies this

#define FLEXIO_I2C_MAX_SIZE (((uint32_t)((0xFFU - 1U) / 18U)) - 1U)

, which evaluates to 13 bytes. I faced the same problem with some I2C chip, which just can't be used due protocol limitations with FlexIO. I had to use dedicated I2C peripheral.

Edward

 

 

 

2,312 Views
Proton_Dev
Contributor II

Hi @kef2 ,

Thank you for the answer and one more issue is that when I am trying to read from my device the same data through flexio_i2c I am no able to read. The bytes are always read as 0x00 NAK and 0x04 NAK and 0xcc NAK. As I am noticing the NAK signal and may be it raising  kFLEXIO_I2C_ReceiveNakFlag = 0x4U, /*< Receive NAK flag. */. But I am not sure what I am doing wrong. Any particular thing to be considered in this case.

0 Kudos
Reply
2,289 Views
kef2
Senior Contributor V

The rest was working well in my case, no problems reading writing smaller pieces of data. 

0 Kudos
Reply
2,328 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Please let us know your chip PN thus we can assign right engineer for it.

Thanks,

Jun Zhang

Tags (1)
0 Kudos
Reply
2,260 Views
Proton_Dev
Contributor II

I have resolved the issue about the reading with flexio_I2C protocol by changing the I2C retry times in master driver. But I dont understand why it did not worked with I2C retry times=0(default value in master driver), it always stuck in that loop  masterreadrblocking() if  I2C retry times set to zero. Is any particular explaination or process needs to be followed or any particular formula. Any lead will be helpful. 

0 Kudos
Reply