Escaping from the ASC boot mode ?

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

cross mob
Not applicable
Hi everyone,

I have managed to get my xmc4500 into the ASC boot mode ready for receipt of a boot loader program into the PSRAM.

However if the end user is unable to proceed with re-programming the flash I would like to be able to escape from the ASC boot mode.

I have tried pulling the PORST pin low (I have a reset button on the pcb) but this has no effect.

Any suggestions would be most welcome.

Best regards
Aaron
0 Likes
15 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi Aaron,

Is this your own created ASC BSL?
0 Likes
Not applicable
Hi Travis,

I'm planning to use the Infineon example ASCLoader. I'm looking for a method to escape from the ASC boot mode and run the normal boot mode while in the following states....

1) After the xmc4500 has detected the ASC baud rate from the 0x00 character and responded with 0xD5, but before the ASC loader hex file has been downloaded into PSRAM.

2) After the ASC loader hex file has been downloaded into PSRAM, but before any flash programming has taken place.

Could you also comment on what might happen and give any advice on recovery methods if the flash programming is partially completed (due to power or comms cable failure etc).

Thank you very much
Aaron
0 Likes
Not applicable
Here was explained a good solution for bootloader implemenation and recovery functions.

http://www.infineonforums.com/threads/1854-Bootloader-running-from-Flash
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi Aaron,

I'm looking for a method to escape from the ASC boot mode and run the normal boot mode while in the following states....

1) After the xmc4500 has detected the ASC baud rate from the 0x00 character and responded with 0xD5, but before the ASC loader hex file has been downloaded into PSRAM.

2) After the ASC loader hex file has been downloaded into PSRAM, but before any flash programming has taken place.


For both mentioned events, I suggest that you can send a status update to the PC that an xxxx error had happened and the XMC is about to reset itself. Once the user confirms, the ASC_BSL can do a software reset.

There is no hard and fast rule regarding to abort ASC_BSL in the event of failure. However there are some status feedback from the ASC_BSL software to inform the PC if each and every process is successful.

Example:



switch (HeaderBlock[1]) {

case BSL_PROTECT_STATUS:
if(CheckProtection() == 0xFF)
SendByte(BSL_SUCCESS);
else
SendByte(BSL_PROTECTION_ERROR);
break;

case BSL_PROGRAM_FLASH:
SendByte(BSL_SUCCESS); // send ackn for header

0 Likes
Not applicable
Thanks very much Shazter & Travis.

I have to say that the boot loader system of the xmc4500 is one of it's few weak points, it is far too complicated. My feeling is there should be a factory bootloader in ROM that can be called from user firmware or hardware pin combination. This is how Atmel devices I have worked with operate.

Then if the ROM bootloader doesn't suit our requirements we can design a bespoke bootloader system but we can still fall back on the ROM bootloader in emergency situations (such as bootloader corruption due to power failure during flash programming).

Anyway thanks again for you time and help

Aaron
0 Likes
Not applicable
Dear Aaron,

no is not complicated other chip vendors makes the same and with the AHB[0] and AHB[1] is fail safe for delivery to end customer.
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

I do find this discussion interesting such that we can improve on our product if it serves the benefit of most user.

I have to say that the boot loader system of the xmc4500 is one of it's few weak points, it is far too complicated. My feeling is there should be a factory bootloader in ROM that can be called from user firmware or hardware pin combination. This is how Atmel devices I have worked with operate.

Normally I believe that this bootloader in ROM of the MCU is being copied into the RAM for execution to communicate with the outside world. As for XMC, the bootloader is downloaded into the RAM via the PC (eg. Memtool). Hence I do find them quite similar.



Then if the ROM bootloader doesn't suit our requirements we can design a bespoke bootloader system but we can still fall back on the ROM bootloader in emergency situations (such as bootloader corruption due to power failure during flash programming).


This actually applies to the XMC which you can make use of the Alternate Boot mode.
0 Likes
Not applicable
Hi Travis,

Thank you very much for your interest and comments.

I have migrated from the Atmel 8051 to the xmc4500. With the Atmel the process for re-flashing the device was very simple...

1) Put the chip into boot loader mode (using a pin combination or control bits via firmware)
2) Run the Atmel supplied PC program called "FLIP", select and download the required hex file to the chip (in our case we called functions within FLIP using DOS commands in a batch file. FLIP also has an API for integration with other applications).

I did not need to create my own boot loader or PC programs.

For the xmc4500 it seems that every programmer has to design their own boot loader and PC program. It would be really nice if Infineon provided a complete solution. I think the following would be desirable...

1) A mechanism for putting the chip into boot loader mode (this already exists on the xmc4500)

2) A PC program with the following features...

a) A PC flash programming user interface that is multilingual or uses icons / symbols instead of words
(this interface would be used during development or by skilled end users)

b) DOS Command line capability
(this interface would enable us to interface with our own PC software for non skilled end users)

c) API / DLL interface
(this interface would enable us to interface with our own PC software for non skilled end users)

d) USB comms

e) CAN comms

f) UART comms

g) Ethernet comms
(we use a Lantronix Ethernet to UART/ASC module on our pcb's so we need to define an IP address and port)

h) A security mechanism to protect the firmware IP
(though I don't need this personally)


This system can still download a boot loader program to the xmc4500 but the end user doesn't need to know about it.

I hope this makes sense.

Very best regards
Aaron
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi Aaron,


1) Put the chip into boot loader mode (using a pin combination or control bits via firmware)


XMC4000 do have hardware pins to set the required boot loader mode (TCK, TMS, HWCON[1], HWCON[0]). You can also set the boot loader mode using software.


2) Run the Atmel supplied PC program called "FLIP", select and download the required hex file to the chip (in our case we called functions within FLIP using DOS commands in a batch file. FLIP also has an API for integration with other applications).

I did not need to create my own boot loader or PC programs.

For the xmc4500 it seems that every programmer has to design their own boot loader and PC program. It would be really nice if Infineon provided a complete solution. I think the following would be desirable...

1) A mechanism for putting the chip into boot loader mode (this already exists on the xmc4500)

2) A PC program with the following features...

a) A PC flash programming user interface that is multilingual or uses icons / symbols instead of words
(this interface would be used during development or by skilled end users)

b) DOS Command line capability
(this interface would enable us to interface with our own PC software for non skilled end users)

c) API / DLL interface
(this interface would enable us to interface with our own PC software for non skilled end users)

d) USB comms

e) CAN comms

f) UART comms

g) Ethernet comms
(we use a Lantronix Ethernet to UART/ASC module on our pcb's so we need to define an IP address and port)

h) A security mechanism to protect the firmware IP
(though I don't need this personally)



If you are using the Infineon memtool and when the XMC4000 is configured and entered into ASC_BSL mode. TheASC_ BSL code will be downloaded into the XMC4000 RAM from the PC, hence there is no need to recreate a BSL. Unless you prefer other mode of BSL such as using CAN, Ethernet, USB etc. I think this is the part which we are lacking, as we do not have a common platform for flash programming using ASC, CAN, Ethernet and USB. However this is possible if you engage 3rd party tool vendors (eg. PLS) is you are willing to pay more $$$.

In fact we do have example code for flash programming using USB and Ethernet.

With regards to security protection, Infineon memtool does provide the necessary flash read and write protection.


This system can still download a boot loader program to the xmc4500 but the end user doesn't need to know about it.


Actually I don't see the need to understand the boot loader program if you are using the Infineon Memtool and doing a standard ASC_BSL. Unless you want to have a customized memtool of your own.

Therefore it is quite hard to strike a balance as some customer wants to customized their BSL loader with tighter security whereby they can implement encryption on the PC side and decryption on the XMC4000 BSL. With this use case, then a fix BSL in the MCU is not capable of doing it.

Correct me if i am wrong, as I might not understand your use case or application. Anyway this discussion is really helpful and hope other user can contribute further so that we can change for the better.


Best Regards
Travis
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi Aaron,

You can refer to this HOT for using Infineon memtool with XMC4000.

http://www.infineonforums.com/threads/2066-XMC_HOT-XMC4500-How-to-do-flash-programming-using-Infineo...
0 Likes
Not applicable
Hi Travis,

Thanks again for your reply.

Flashing the chip with a miniWiggler and MemTool is easy if you are an embedded engineer.

However the end user of the product will have zero understanding of embedded systems, will not have a miniWiggler and will not be able to use the MemTool user interface for the following reasons...

1) They will have no idea which buttons to press and which file to load etc
2) 98% of our products are exported to non English speaking countries and I don't think MemTool can run in Chinese etc.

We need to make the process as simple as possible for the end user, maybe with MemTool batch commands or maybe through a MemTool API. Can you tell me if MemTool has an API so we can call it's functions from our own program ?

Thanks again Travis
Best regards
Aaron
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi Aaron,

Now I understand where you are coming from. For end user firmware update, our customer has to create their own memtool and ASC_BSL etc. And I agree that this is no easy task.

We need to make the process as simple as possible for the end user, maybe with MemTool batch commands or maybe through a MemTool API. Can you tell me if MemTool has an API so we can call it's functions from our own program ?

No, sorry to say that Infineon memtool does not provide the API or batch command. In any case if you need professional support for flash programming you can check with PLS.
0 Likes
Not applicable
Hi Travis,

Thank you for the confirmation. We will write our own PC program for the end user.

I think it would be useful to place an Infineon approved boot loader hex file in the tools section of the Infineon web site. e.g. The one from the 'ASCLoader' project.

Thanks again for your time.

Best regards
Aaron
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi Aaron,

There is already one. The app note include a PC program (Developed using MS visual C) with the necessary API functions and also the ASC_BSL example code. And I believe this shall gear you up pretty fast for a customized XMC flash programming tool.

1690.attach

http://www.infineon.com/cms/en/product/microcontrollers/32-bit-xmc4000-industrial-microcontrollers-a...

Best Regards
Travis
0 Likes
Not applicable
Thanks Travis. 🙂
0 Likes