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:
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:
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:
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):
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.
I2C_BootloaderHost.zip 5.8 MB