AnsweredAssumed Answered

KL28 LPI2C Driver

Question asked by testbed on Sep 2, 2018
Latest reply on Sep 10, 2018 by Jing Pan

Hello,

 

Is it possible to send an ACK to the slave  using the LPI2C of KL28 ?

 

I am trying to interface pn532 to KL28.  The below line i use to read the response from the  pn532.

 

stat = LPI2C_DRV_MasterReceiveDataBlocking(INST_LPI2C1, rxbuffer, 256, true, OSIF_WAIT_FOREVER);

The above statement works.

 

Instead of reading 256 bytes every-time i would like to read  byte by byte and stop when the read bytes equal to

the length that was received in the response header.

 

E.g (probed from analyzer) What i would like to do is this - Get length in red and read only those many bytes in black bold

 

Start, h48 [ h24 | WR ], h00, h00, hFF, h02, hFE, hD4, h02, h2A, h00, Stop [GetFirmwareVersion]
Start, h49 [ h24 | RD ], h01, h00, h00, hFF, h00, hFF NAK, Stop [ACK]

Start, h49 [ h24 | RD ], h01, h00, h00, hFF, h06, hFA, hD5, h03, h32, h01, h06, h07 NAK, Stop [Response]

 

Instead of reading worst case 256 bytes for every command (from KL28)

 

Start, h48 [ h24 | WR ], h00, h00, hFF, h02, hFE, hD4, h02, h2A, h00, Stop
Start, h49 [ h24 | RD ], h01, h00, h00, hFF, h00, hFF NAK, Stop
Start, h49 [ h24 | RD ], h01, h00, h00, hFF, h06, hFA, hD5, h03, h32, h01, h06, h07, hE8, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00 NAK, Stop

 

I do not want to hard code/keep track of the response length of every command as i am going to be using indataexchange where the data length may vary (less than 256B) and reading 256 bytes each time will not be efficient.

 

I have successfully implemented the same with the IIC peripheral of KW31Z which has ACK bit generation feature. Just wondering if it is possible with LPI2C...

 

 

Thanks

Outcomes