Changing BMI setting via ASC BSL (UART)

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

cross mob
User8683
Level 4
Level 4
First like received
Hello,

I am trying to set the BMI mode using ASC BSL, but unfortunately the documentation and sample program XMC1x_ASCLoader.hex do not match and neither is working.

I have used section 3.5.2 from the documentation https://www.infineon.com/dgdl/Infineon-TOO_XMC1000_Boot_Modes-ApplicationNotes-v01_04-EN.pdf?fileId=... which is current as of October 2019.

In that section, the header references a Page Address and does not indicate the location of the BMI mode within the header.

Using the reference program, XMC1x_ASCLoader.hex, the bytes that are sent are the following:

00 01 00 00 ff d0 00 00 00 00 00 00 00 00 00 2e

These bytes suggest that the Page Address is the BMI setting. However, the second byte of the header does not match the header in the documentation. As well, the XMC1x_ASCLoader.hex program bricked two chips when I attempted to set the setting to option 10, which should be 0xFFD0. It appeared to hang. If it requires some nontrivial amount of time to set the BMI mode, the program should show a timer or something.

As a result, I am not sure what the correct bytes are or what I am doing wrong. I really don't want to brick more chips.

Please fix the 3.5.2 section documentation and update the program XMC1x_ASCLoader.hex to either properly set the BMI or to clearly indicate if there is some time frame required before the BMI setting is complete.
0 Likes
15 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

The BMI=0xFFD0 corresponds to ASC_BSLTO. In this mode, if the external tool is not connecting before 5s then the device switches to User Productive Mode (UPM) where debugging is not possible.
Which BMI do you want to program?


You are right, the documentation should be updated. The Mode byte for the Change BMI command is 0x1 and the BMI requested value is contained in bytes 4 and 5.


Regards,
Jesus
0 Likes
User8683
Level 4
Level 4
First like received
Thanks for the response. 0xFFD0 is the mode I wanted to program, but both attempts to write the BMI in the Infineon supplied test program by selecting option 10 ended up hanging the program without a response and resulting in my chips not being accessible with Memtool. They also weren't accessible by UART although the program I flashed normally provides a UART interface.
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Have you try to program the BMI using Infineon Memtool?

regards,
Jesus
0 Likes
User8683
Level 4
Level 4
First like received
Hi,

As mentioned on the 20th, the chips are no longer accessible via Memtool. I cannot connect to the chips to provide any further programming. I can program the BMI normally on other chips with Memtool but that does not address the issues associated with using the Infineon supplied test program. I would like to know if it is working and whether there is any special messaging or other actions required when setting the BMI mode via ASC BSL.

Thanks,

Jason
0 Likes
User8683
Level 4
Level 4
First like received
Hi Jesus,

Any update to my question from last week?

Thanks,

Jason
0 Likes
User8683
Level 4
Level 4
First like received
Any update to my question? Anyone?
0 Likes
User8683
Level 4
Level 4
First like received
Is there a better way to get a response than this forum? Nobody seems to be monitoring it.
0 Likes
User14451
Level 2
Level 2
10 replies posted 10 questions asked 5 replies posted
Hi longtimer,
sorry for the stupid question: have you tried to get the BMI with the Set-Get BMI utility in DAVE?
Wich is the result?
As far as I am concerned, I always use that utility to change the BMI value. The XMC cpu's always come from factory with P0.14 and P0.15 ready to be connected in SWD mode, and it's quite easy to change BMI value using the DAVE utility.


Hope this helps.

Best Regards

Fabio
0 Likes
User8683
Level 4
Level 4
First like received
Hi Fabio,

Thanks for the reponse.

I have not been using the Dave utility to do this. As far as I know, it is no different than Memtool in that it requires the chip to respond to a handshake and specific messaging.

For the chips that are new, Memtool works just fine. However, attempting to follow Infineon's example programming tool to set the BMI does not work and I am looking for a working example to be able to program the chips with a jig.

If Infineon actually monitored these forums, they would see that my issue has still not been resolved.

Unfortunately, they don't seem to be monitoring the communications in these threads.

Thanks,

Jason
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

For me it is working without issues

====================================================================
= =
= XMC1x_Load v1.1 - Flash Programming for XMC1xxx Devices =
= =
= Supported Devices: =
= =
= XMC1000 family: =
= (1) 200KB: XMC1200_200, XMC1300_200, XMC1400_200 =
= (2) 128KB: XMC1200_128, XMC1300_128, XMC1400_128 =
= (3) 64KB: XMC1100_64, XMC1200_64, XMC1300_64, XMC1400_64 =
= (4) 32KB: XMC1100_32, XMC1200_32, XMC1300_32, XMC1400_32 =
= (5) 16KB: XMC1100_16, XMC1200_16, XMC1300_16, XMC1400_16 =
= (6) 8KB: XMC1100_8, XMC1200_8, XMC1300_8, XMC1400_8 =
= =
====================================================================


Please Enter the device to program (Enter number)
1 = 200 KB Flash
2 = 128 KB Flash
3 = 64 KB Flash
4 = 32 KB Flash
5 = 16 KB Flash
6 = 8 KB Flash
1

Please Enter the INTERFACE to use (1 = ASC): 1

Please Enter the COM Port to use (e.g: COM6): COM9

Please Enter the BAUDRATE to use (e.g: 19200): 19200

Setup ASC bootloader mode, please press any key to continue

Initializing primary boot loader... done

Please Enter the 4 bytes Application Length (e.g: 4096): 4096

Send 4 bytes applcation length... done

Using XMC1x_ASCLoader version: 2019.11.1
Sending XMC1x_ASCLoader... done

Do you want to download a HEX file?
1 = YES
2 = NO
1

Enter the hexfile name of the user code to be downloaded: XMC1300_Blinky.hex

Erasing sector 0x10001000 (This may take a few seconds)... done

Programming data block to address 0x10001000... done
Programming data block to address 0x10001100... done
Programming data block to address 0x10001200... done
Programming data block to address 0x10001300... done
Programming data block to address 0x10001400... done
Programming data block to address 0x10001500... done

Do you want to read Flash?
1 = YES
2 = NO
2

Do you want to change the BMI value?
1 = User Mode Productive
2 = SWD_0 User Mode
3 = SWD_1 User Mode
4 = SPD_0 User Mode
5 = SPD_1 User Mode
6 = SWD_0 HAR Mode
7 = SWD_1 HAR Mode
8 = SPD_0 HAR Mode
9 = SPD_1 HAR Mode
10 = ASC_BSL TO 5sec FD Mode
11 = NO
10

Program terminated

Program terminated


The LED P00 will start blinking.
After that I was able to modify the BMI using the IFX Memtool.

Could you verify the value of CLKVAL1_SSW in the startup_XMC1x00.S file?
If you are using the latest version of that file, CLKVAL1_SSW should be 0x00010400 that gives a default MCLK=8MHz to give you the 5s time to connect with the memtool before it switches to the user productive mode.
Once in the productive mode you will not be able to connect. The only option is to do a power cycle and retry the connection. For this the "Periodically Retry" option is very helpful.

4564.attach

Regards,
Jesus

Regards,
Jesus
0 Likes
User8683
Level 4
Level 4
First like received
Hi Jesus,

Thanks for getting back to me. I am not sure what the best way is on this forum so that those of you doing support can see responses. If there is a better way, it would be good to add a sticky topic on that.

Regarding the BMI changes, I was trying to set the BMI via the sample program using custom hardware and a custom application. Setting BMI via Memtool worked fine but the program just hung when trying to set the BMI. It never reached the 'program terminated' output. How long does this take? It might be good to show a message indicating the amount of time it can take.

If setting of the BMI was interrupted, what is the expected result on the chip. In my case, there is no response at all from the chip when the 0 byte is sent via memtool after I attempted to use the custom application. I was attempting to set it to ASC BSL with the 5 second timeout.

Thanks,

Jason
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

According to the datasheet the BMI programming time is 8.25ms.
Could you show a log of the run of XMC1x_Load in your case?

Regards,
Jesus
0 Likes
User8683
Level 4
Level 4
First like received
Hi Jesus,

My output simply looked like this:


Do you want to change the BMI value?
1 = User Mode Productive
2 = SWD_0 User Mode
3 = SWD_1 User Mode
4 = SPD_0 User Mode
5 = SPD_1 User Mode
6 = SWD_0 HAR Mode
7 = SWD_1 HAR Mode
8 = SPD_0 HAR Mode
9 = SPD_1 HAR Mode
10 = ASC_BSL TO 5sec FD Mode
11 = NO
10



It never showed anything else in the window and I eventually just closed the window.

At the same time, I have noticed that Memtool takes several seconds before it responds so the 8.25 milliseconds does not seem to be the entire story. Is that just memtool or some other reason for the delay?

Thanks,

Jason
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

The 8.25ms looks to me reasonable taking into account that the page erase takes max. 7.6ms and the block programming takes max. 204us.
The BMI and the inverse of the BMI are stored in a flash as two consecutives blocks (see Reference Manual, Table 27-3 Flash data for SSW and user SW in XMC1400)
If a mismatch is found between the BMI and the inverse BMI after the reset, the BMI is reprogramed to ASC_BSL.

Therefore I do not think you are having an issue with that. Could you show the full output of the tool?

Which USB to Serial device do you use?
If you look at the code of XMC1x_Load.cpp, after sending the command to configure the BMI, it just closes the serial port and prints the message "Program terminated"
The windows closeHandle((Handle)port) function is used to close the port. It seems that in your case closeHandle does not return, https://stackoverflow.com/questions/57435800/closehandlehandle-port-is-not-returning

Regards,
Jesus
0 Likes
OlCh_4641241
Level 1
Level 1
First like given
I have similar problems.
I was trying to set BMI by XMC flasher, but it doesn't work after click the button.
Board and connection was correct, because after chip change, it works. But this problem occurs sometimes when I use new chip.
Once chip malfunction during BMI set, I can't make it back to normal.
0 Likes