FLexIO_I2C_Driver problem

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

FLexIO_I2C_Driver problem

1,566 Views
mohamed_ahmed-a
Contributor I

Hello all,

I'm working on S32_116 target specially with I2C Flexio peripheral and I have a confusion about I2C Non-Blocking driver.as I have read Doxygen Documentation of this module there's two types of Transmission,Blocking and Non-Blocking and I want to use the Non-Blocking one.so there's an API called "MasterGetStatus" as described in documentation this API must be called once at least to send a byte but when I call it once after Calling API "MasterSendData" and watching the Bus on Digital analyzer it turns out that it sends a bit or something weird.

so my Question is what Exactly This API "MasterGetStatus" did if it's Called once ,cause after testing it turns out that it didn't send a byte at all and what If i want to call "masterGetStatus" in a periodic task every 8ms to handle the transmission cause I have tried it also but the transmission Failed.

Thank you 

Labels (1)
Tags (1)
0 Kudos
Reply
3 Replies

1,352 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello mohamed.ahmed-abbas@valeo.com,

What do you send and what do you see on the bus?

Are you using Interrupt or Polling mode?

And what is the MasterGetStatus return values (status, bytesRemaining)?

BR, Daniel

0 Kudos
Reply

1,352 Views
mohamed_ahmed-a
Contributor I

Hello Daniel,

Iam sending a byte or more and when calling this API "MasterGetStatus" with polling it seems for me that sending one bit not a byte ..I called API "MasterSendData()" then through while loop calling "MasterGetStatus" to handle the transmission until exit condition on STATUS_SUCCESS..but when I called this API "MasterGetStatus" every 8ms ,error code is shown up with "RX_underrun" error ..also through debugging I tried to count how many time API"MasterGetStatus" is called until transmission Ends and it turns out it loops more than 40 times to send 3 Bytes ..so Iam confused with this API and how it's used ..also how can I used interrupt driving type and what API Shall be called to handle the transmission ?

Thank you

0 Kudos
Reply

1,352 Views
cristianzamfire
NXP Employee
NXP Employee

   Hello,

   In polling mode MasterGetStatus must be called periodically to check if the FlexIO module has received any data or needs more data to transmit. MasterSendData just provides FlexIO with the first byte (the address) and then MasterGetStatus must provide the rest o the bytes one by one. If the device completes sending a byte and has not yet received the next one, it will signal Tx_underflow, because FlexIO can't do clock stretching in this situation. So if you get this return code it probably means MasterGetStatus must be called more often.
   If you want to switch to interrupt mode you need to set the driverType field in the configuration structure to FLEXIO_DRIVER_TYPE_INTERRUPTS. Then it will not matter how frequent the MasterGetStatus is called because the data will be sent/received by interrupts and MasterGetStatus only checks if the transfer is over.
   Please also check the driver manual for more information.

   Best regards,
   Cristian

0 Kudos
Reply