The bootloader on my board’s flash memory has been overwritten and so I need to reflash the chip using a programmer or J-Link style device.
I tried downloading the [bootloader hex files from Infineon, but there does not seem to be a hex file related to the specific chip on the VLK (CY8C5868LTI-LP039).
Next, I went to the project I built using the[GitHub and did find a Bootloader.hex and Variable_Load.hex, but neither of those put the board back to a usable state. The closest I could get with that was for the com port to enumerate, but nothing was being printed to the serial port or the LCD screen and I could not launch the bootloader mode by typing ‘B’ then pressing enter. [This did not fix the issue. I did find a config.hex file in the generated source folder in the built project but there is no information about where and how to combine it with either of the above hex files.
My guess is that the manufacturer’s hex used to initially flash the chip is different than the hex files generated in the built project, as SparkFun anticipated all rewriting of the flash to be done through the PSoC Creator bootloader host. I of course cannot use the bootloader host because my board is not properly speaking to anything for me to have it in the bootloadable state.
If the hex file originally used to build the product is available, I would greatly appreciate knowing where it is or if someone could send it to me. I currently cannot do what I am trying to do without buying another VLK, as this one is effectively bricked.](Flashing Infineon PSoC Creator output data files with J-Flash - SEGGER Wiki)](GitHub - sparkfun/Variable_Load: Digitally controlled variable current draw load board.)](https://www.infineon.com/cms/en/product/microcontroller/32-bit-psoc-arm-cortex-microcontroller/32-bit-psoc-5-lp-arm-cortex-m3/cy8c58lpxxx/cy8c5868lti-lp039/)
Found it!
Have a great day
Variable_Load_v30.zip (56.1 KB)
Thank you, but it sadly still does not work. The bootloader on this hex seems to at least partially work, as the com port does enumerate. But the program does not seem to run, as there is no output on the lcd display or serial port, and no commands I send to it through the serial port seem to do anything. The on-board buttons also do nothing, as well as the LOAD_ON led never turning on or blinking.
I am using a J-Link to flash the chip. Through J-Link Commander, I connect to the chip, erase it, load the hex file onto it, unplug the board and plug it back in. The com port does indeed enumerate but like I said above, it does not function in any usable way. It is connected through the usb and the J-Link the whole time I am doing this process. I am not trying to power the board with just the J-Link.
I also compared the Variable_Load.hex (hex file generated by the code) to the Variable_Load_v30.hex (manufacturer’s hex) and they are different, but the first chunk of the hex is the exact same, leading me to believe the bootloader is no different between the two and it is just the program that is different.
Thank you for helping me and hopefully a robust fix can be made for the VLK so development on the board mustn’t stop when the board hits a hiccup like so. It’d be awesome if for every time I accidentally brick the chip, I could just reflash the original hex file back onto it and get back to developing.
TL;DR for all people running into this problem while editing the code on the board: You need a PSoC programmer. I specifically used the MiniProg3, but it seems like the MiniProg4 would work as well.
Terminology: I am going to refer to flashing the chip with a programmer as flashing. I am going to refer to flashing the chip using a bootloader as programming.
Since my previous post, I had gotten the board into a semi-functional state using a J-Link to flash a built Variable_Load.hex (which has both the variable load application and the bootloader in the hex file) and having the program always go straight into bootloader mode (in the bootloader’s main.c I had put the code in the if statement inside the else statement as well so that it just always started the bootloader). With this, I could go into PSoC Creator and program the board using the bootloader, which would automatically start the application after it programmed the device. You cannot change the bootloader’s code when using the bootloader itself to load new application code on to the chip, so this workaround meant that every time I unplugged the device and plugged it back in I would have to reprogram it. This of course was not going to work for me as I needed the device to work without connection to a computer. Since there is a config.hex file in the generated source folder of the project folders, flashing the board using a J-Link and the Variable_Load.hex of course would not work as the instructions on where exactly to place specific code or checksums were not there to instruct.
This is when I said screw it and bought the PSoC Programmer (MiniProg3). Using it, I could connect to the board through PSoC Creator (Debug>Program (Ctrl+F5)) and select the correct settings under Port Settings (Power must be 3.3V and Connector must be 5 pin, Active Protocol was SWD for me and I did not touch Clock Speed (3.0 MHz) or Acquire mode (Reset)). I did not plug in the board as the programmer was powering it. Once I O.K.ed these settings, I double-clicked on the board in that program menu and closed the menu. I then clicked the “Program” button above the Workspace Explorer on the left side of the IDE, of which the icon is a purple chip with binary over the top. With this, the board was resurrected and when I plugged it in, worked just as expected (with my code on it!!)!
The person who updated the code for the board in 2018 probably did all of this through PSoC Creator and using a PSoC programmer so it all worked seamlessly and was abstracted away. Since I had a J-Link, nothing was abstracted away and since there are no tools from Infineon or Cypress or whoever you want to call the company behind PSoC, I could not fix this problem unless I had the same knowledge as the sorts of people who make chips and programmers (geniuses) and knew how to put 0-based config intel hex files into 0-based application hex files like a low-level wizard. I was forced to use a 1st party product so that I could use the specifically made buttons with the chip instead of trying to do it myself. If PSoC Creator gave you an option to combine the Variable_Load.hex and config.hex into one full production/manufacturer’s hex file that you could flash/“beam” onto the chip using any programmer you like, that would be awesome but sadly is not possible from what I can tell. A capability like that would save much headache and money of the consumer.