I successfully programmed the kit along with the bootloader and found it to be working satisfactorily. I am using the serial port program mode as I do not have Mini Programmer. I even power cycled it multiple times and it was working fine.

If I switch on the power after a day, the kit automatically goes in to bootloader mode and the main program does not work.

I anticipate that the bootloader is working fine however the main program is getting corrupted. Any pointers in this regards will be helpful.

We have seen issues like yours with (very) bad power supplies. Do you use emEEProm component or are you writing to flash with your bootloaded program?

Can you post both your complete projects, Bootloader and Bootloadable, so that we all can have a look at all of your settings? To do so, use Creator->File->Create Workspace Bundle (minimal) and attach the resulting file.

Thank your for the reply. I found your other posts helpful for solving my problems till date.

I have attached my demo code. Yes, I am using the emEEProm component, The kit is powered from the USB port. As the PCB is a loose fit into the USB post, there may be a possibility of power fluctuations.

there was an issue posted by a user (SpiderKenny??) concerning Bootloadert and emEEProm. As far as I remember, a workaround was to manually call the die-temperature function. I would suggest you (as a try) to disable the access to the emEEProm.

Another issue will be: changing a byte within your code area will change the checksum of the bootloadable, thus telling the bootloader that the bootloadable is invalid and a new upload is required.

And lastly: In your interrupt handler for SER you only handle and reset your expected interrupt, all others you do not clear which may turn out to be an infinite loop when there are any errors.

Access to the eeprom is integral to my logic and I will have to use it. I will look into the workaround. One peculiar thing in my case is the bootloader is working fine (on the second day) however the bootloadable program is failing.

This is occurring even when I am not accessing the eeprom on the earlier day (ie no read or writes), if you see my code the eeprom is modified only if there is a serial char received.

If the checksum was the problem then immediately on the next power cycle the device should complain. and not a day afterwards.

I did not look into much details for the SER interrupt as this was proof of concept program, but will do so in the final prog. Presently I am sure that none of the errors are causing infinite loop. Still thank you for the pointer.

I am having a feeling that the issue is with the em_EEPROM and checksum in case the content is modified.

I was wondering, how do I workaround the problem if it is with the checksum. Can I place the variables in bootloadable code at the beginning, so as to direct the bootloadable block to avoid that area for checksum computation?

The bootloader was configured with the initial flash memory as write protected. I was uploading the code over the serial port, using a bootloader utility. I guess this portion of the code was not getting modified, even when I tried uploading the code through the serial port. (I am not sure if this is the case, as I have superficially read the flash programming details).

I could lay my hand on a MiniProg and programmed with the flash memory as unprotected and configured the bootloader with fast bootloadable application validation option, This solved my problem.

From this experience, I feel it would be great if cypress could provide option for keeping the em_EEPROM data out of checksum preview. It would also be helpful if we can configure the address area and size to be used, and group the set of eeprom variables using precompiler directive.

Glad that your issues are resolved. I don't think the write protection of Bootloader might have caused the issue.The bootloader Flash region will get modified and it is recommended to have the Bootloader area protected.

For excluding a particular region from checksum calculation you can use the new feature in bootloadable component.You can give the size of the area that need to be excluded from the checksum calculation.This area will be placed at the end of flash just before the metadata region.After giving the size, a new section called cy_checksum_exclude. Now you need to declare your array in this section.

I have created a simple example project for using the exclude checksum. As you mentioned in the forum post it is not possible to reserve 0000 to 7fff for checksum exclude. The checksum exclude function will be placed just below the metadata address.Please refer to the cm0gcc.ld file with the checksum exclude section enabled.Then you can see the placement of checksum exclude section.

In this project I have used the SCB UART bootloader project and the Emulated EEPROM component example project as bootloadable. I have reserved 40 bytes for checksum exclude.The emulated EEPROM array I have declared inside the checksum exclude section. Please note that this project is not 100% tested for all variations. This is just a sample project.