Firmware works with Flip GUI, but not with BatchISP

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

 

I'm using an AT90CAN32 CAN- equipped microcontroller for a current project. In fact there are 16 AT90CAN32 connected on one CAN- Bus. Although my board has testpads and a custom programming adapter which I made and which connects to those testpads, the process of firmware update should be done completly over the CAN interface.

I've downloaded and adapted the CAN- 4K Bootloader from Microchip, which can be accessed through the device page on their website.

http://www.microchip.com//wwwApp...

The bootloader also works fine to me. Although I have a slight problem, which is not severe, but annoys the hell out of me.

If I program my firmware hex- file with the Atmel Flip utility, and then click on "Start Application" after it has programmed, the firmware starts up fine. This i can observe, as then there is a communication over the CAN- Bus and the AT90CAN32 writes out my sensor- data, as it should.

If I use the batchisp utility, as intended in the final product, a thing happens which I can't explain, nor I have the slightest idea what is causing it. Maybe some of you can help me out with his wisdom. smiley

I get all green in the batchisp- commandline, although the firmware does not start up at all. There is no communication (as it should, as mentioned above) over the CAN bus. Even when cycling the power the chip continues to keep silent.

 

Here is my Commandline for BatchISP:

 

batchisp -device AT90CAN32 -hardware kvaser -canbitrate 500 -operation CANOPEN 0x02 LOADBUFFER "Firmware.hex" MEMORY FLASH ERASE f BLANKCHECK PROGRAM VERIFY READ SAVEBUFFER "Firmware_read.hex" hex386 START NORESET 0 CANCLOSE 0x02

And the output of the batchisp commandline tool:

C:\Program Files (x86)\Atmel\Flip 3.4.7\bin>batchisp -device AT90CAN32 -hardware kvaser -canbitrate 500 -operation CANOPEN 0x02 LOADBUFFER "Firmware.hex" MEMORY FLASH ERASE f BLANKCHECK PROGRAM VERIFY READ SAVEBUFFER "Firmware_read.hex" hex386 START NORESET 0 CANCLOSE 0x02
Running batchisp 1.2.5 on Sat Mar 07 00:43:26 2020

AT90CAN32 - KVASER - 500Kbit

Device selection....................... PASS
Hardware selection..................... PASS
Opening port........................... PASS
Opening CAN Node....................... PASS    0x02    0x00
Reading Bootloader version............. PASS    1.0.4
Parsing HEX file....................... PASS    Firmware.hex
Selecting FLASH........................ PASS
Erasing................................ PASS
Blank checking......................... PASS    0x00000 0x05fff
Programming memory..................... PASS    0x00000 0x05fff
Verifying memory....................... PASS    0x00000 0x05fff
Reading memory......................... PASS    0x00000 0x05fff
Saving buffer to HEX file.............. PASS    Firmware_read.hex HEX386
Starting Application................... PASS    NORESET 0
Closing CAN Node....................... PASS    0x02

Summary:  Total 15   Passed 15   Failed 0

C:\Program Files (x86)\Atmel\Flip 3.4.7\bin>

As you can see, I also read out the Flash after programming. I've also compared the source- hex file and the read- hex file with notepad++'s compare utility, and they are both exactly the same to the last byte. So the machine code in the device is the exact same as in the source- hex file. So the firmware should work perfectly.

So my only idea is, that there need to be some extra configuration in the CAN- Bootloader, so that the firmware is correctly executed. I've read something of a BootStatusByte which needs to be set to 0x00 elsewhere on the internet. Although the RBSB and WBSB commands don't seem to work in batchisp with my bootloader.

AT90CAN32 - KVASER - 500Kbit


Device selection....................... PASS
Hardware selection..................... PASS
Opening port........................... PASS
Opening CAN Node....................... PASS    0x02    0x00
Reading Bootloader version............. PASS    1.0.4
Reading Boot Status Byte............... FAIL    Command does not exist.
(A)bort, (R)etry, (I)gnore ? a

ISP done.

As documentation for the inner workings of batchisp is really sparse in my opinion, even after 6h of debugging, I didn't go further.

Maybe someone of you has the final piece of the puzzle to make this work.

 

Thanks in advance,

Gregor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Obviously BatchISP corrupts the hex data while programming, so it doesn't work.

 

I've programmed the same unchanged hex- file with FLIP and then read it using a Atmel ICE via ISP.

Then I programmed the same unchanged hex- file with batchisp and read it using a Atmel ICE via ISP.

 

Now I expect, that both hex files are the same, but they aren't. And there are not minor differences, literally the complete hex code programmed with batchisp is different from the hex code programmed with FLIP.

I made a diff from both files with notepad++'s compare utility.

 

Let's take the following line in the hex file:

 

FLIP above, Batchisp below
 

:10009000 0C 94 67 00 11 24 1F BE CF EF D8 E0 DE BF CD BF A8
:10009000 0C 94 67 00 11 24 1F BE CF EF D0 E1 DE BF CD BF AF

 

Interestingly, if I open the hex file, which BatchISP reads back and saves, then they match perfectly. But obviously in reality thats not the case, because I thrust the hex data read with the Atmel ICE more than the hex read back by Batch-ISP

 

Anyone an idea. Do I need some switch in the commandline, so that the source hex is parsed correctly?

 

That's my commandline:

batchisp -device AT90CAN32 -hardware kvaser -canbitrate 500 -operation CANOPEN 0x0F LOADBUFFER "E0390_Firmware.hex" MEMORY FLASH ERASE f BLANKCHECK PROGRAM VERIFY READ SAVEBUFFER "E0390_Firmware_read.hex" hex386 START NORESET 0 CANCLOSE 0x0F