UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
775 Views
Registered: ‎03-23-2015

I2C Slave driver flags XIICPS_EVENT_ERROR for error-free receive

Hi,

  Setup:

    Tool: SDK 2016.3

    IP core: Zynq PS I2C

    Driver version: iicps_v3_0

 

    Zynq I2C is slave and needs to receive variable length I2C write commands from master.  I am using 1 addr + 2 data byte write for testing.  I have checked on Vivado ILA Zynq I2C acknowledges each byte transfer correctly.  An interrupt is generated after master generate I2C stop condition.

    I am running I2C Slave example which init rx buffer to 250 bytes.

 

  In the ISR,  event XIICPS_EVENT_ERROR  is generated by ISR.

 

xiicps_slave.c, line 521:
  if (0U != (IntrStatusReg & XIICPS_IXR_COMP_MASK)) {
    if (IsSend != 0x0U) {
      if (InstancePtr->SendByteCount > 0) {
        StatusEvent |= XIICPS_EVENT_ERROR;
      }else {
        StatusEvent |= XIICPS_EVENT_COMPLETE_SEND;
      }
    } else {
      LeftOver = SlaveRecvData(InstancePtr);  <------  returns 248.  Buffer is 250 bytes, filled up with 2 bytes, so leftover 248
      if (LeftOver > 0) {
        StatusEvent |= XIICPS_EVENT_ERROR;  <------ XIICPS_EVENT_ERROR  generated here
      } else {
        StatusEvent |= XIICPS_EVENT_COMPLETE_RECV;
    }
  }
}

 

  Why does driver flags a error event when data is correctly received?  I intend to create my own version of ISR to flag XIICPS_EVENT_COMPLETE_RECV instead.  Anyone know whether this will create any potential problem down the road?

 

Neo

0 Kudos
2 Replies
Voyager
Voyager
759 Views
Registered: ‎06-24-2013

Re: I2C Slave driver flags XIICPS_EVENT_ERROR for error-free receive

Hey Neo,

 

Why does driver flags a error event when data is correctly received?

Because it assumes that a proper I2C receive has to have 250 bytes (from the rx buffer size).

 

I intend to create my own version of ISR to flag XIICPS_EVENT_COMPLETE_RECV instead.

This is fine, just keep in mind that you change the semantics.

 

Anyone know whether this will create any potential problem down the road?

As long as you know how many bytes have been received, it should be fine.

 

Best,

Herbert

-------------- Yes, I do this for fun!
0 Kudos
Adventurer
Adventurer
725 Views
Registered: ‎09-25-2017

Re: I2C Slave driver flags XIICPS_EVENT_ERROR for error-free receive

Tks Herbert.

 

  I was expecting the API to provide I2C slave functions just like most other I2C ICs that accept variable length writes.

 

Neo

0 Kudos