CY7C65211A I2C Bootloader host is requesting too many bytes from PSoC5LP device?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
KyTr_1955226
Level 6
Level 6
250 sign-ins 10 likes given 50 solutions authored

I'm running into some strange issues with trying to develop an I2C Bootloader Host.

The problem I'm having looks at least on the surface similar to this issue I was having about a year and a half ago, so this may end up being sort of a sequel to that thread:

I2C Bootloader Error: PSoC Bootloader sending extra bytes to host?

Basically, I have an I2C Bootloader Host program built in C#, using interop services for use of cyusbserial.dll and bootl_utils.dll.

cyusbserial.dll is the one found here that fixes ACKs being too long: Reduce Delay Observed During I2C Read Operations In USB-Serial – KBA227320

bootl_utils.dll is built from the source included with PSoC Creator 4.1.  The only change I made to the bootl_utils source is described my previous thread at the top of this post. (it shouldn't have an effect on the current behavior, but who knows!)

I am interfacing with a CY7C65211A USB-Serial bridge in I2C Vendor mode.

Interfacing with the bridge appears to be no issue.  I can send my "Enter Bootloader" command to the I2C slave device and it enters the loader as instructed.

The problem comes when I try and actually bootload the PSoC5.

When I attempt to bootload, the first command to enter the bootloader looks completely fine:

bootl_enter.JPG

The problem arises with the first read, where the host keeps ACKing data well past the EoP byte (0x17).  The packet looks good, the host app just keeps reading for some reason:

bootl_read.JPG

The read then hangs on an 0xFF byte, until eventually (5 seconds later, the configured read timeout) the host finally NAKs and sends the command to exit the bootloader (0x3B):

exit.JPG

I have confirmed that this is definitely an issue with the host application.  I am able to enter the bootloader with my application, then bootload successfully using the Bootloader Host included with Creator and the I2C Bridge in the MiniProg3.  I'm just at a loss as to where this is going wrong.  In my ReadData() function on the host, it is entering with the correct size parameter.  I confirmed via debug breakpoint that length == 16, which is correct if we include the address byte.  I have no idea why it is ACKing all these extra bytes?

The error code returned from CyBtldr_Program() is the CYRET_ERR_BTLDR_MASK (0x4000) with no error code, which I suppose makes sense, as the status byte from the target is 0x00 (SUCCESS).

I have attached the Bootloader Host Application project.  Maybe someone can point something out that I'm missing?  It's not the cleanest code (I've been messing with it quite a bit), but it shouldn't be too hard to navigate hopefully.

0 Likes
1 Solution
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello,

I have gone through the host application. Please see my comments below:

1. Based on the register address size of the slave device, before the read transaction, an I2C write should be initiated with the starting  register address in the  CY_DATA_BUFFER.buffer field and the register address size in the CY_DATA_BUFFER.length field.  In the same write transaction the isNakBit  and isStopBit field of the CY_I2C_DATA_CONFIG should be set to false. Make sure if this sequence is followed while debugging the application.

2. Before calling the CyI2cRead, the CY_I2C_DATA_CONFIG should be configured with isNakBit = true and isStopBit = true, please check if this is properly configured while debugging and the length of the CY_DATA_BUFFER should be the actual length that is to be read from the device.

Please check if the above conditions are met. If they are proper, then you can use the try the old cyusbserial.dll and check if you are still facing the problem.

Thanks,

Yatheesh

View solution in original post

0 Likes
13 Replies