chipKIT® Development Platform

Inspired by Arduino™

Faulty programming

Created Mon, 04 Mar 2019 11:59:36 +0000 by Herbmaster


Herbmaster

Mon, 04 Mar 2019 11:59:36 +0000

Hi there,

I am running into a memory-related programming issue, I’m not sure how to fix... We are currently using a bare-metal board in one of our projects. In a previous version we used a “PIC32MX250F128D” with a connection similar to the "Fubarino Mini" so we were able to program the board using MPIDE telling it a "Fubarino-Mini" was connected.

In a newer version we switched to a “PIC32MX270F256D” due to its bigger memory and architectural similarities.

Since both controllers share a nearly similar structure, we modified the addressable memory within the linker-script of the "Fubarino Mini". At first this worked just fine using the IDE (MPIDE or Arduino - with chipKIT-Core 2.0.5).

Now to the big issue: we currently exceeded the 128kiB of needed programming memory, but now the IDE just stops the programming when it tries to enter the second half of the “Program-Memory” and seems to have run into a never-ending loop.

Now we tested to go with the Arduino and “chipKIT-Core 2.0.6” and telling Arduino a “Fubarino Mini 2” was connected but the same issue appeared again.

Now I’m asking if anyone has had similar problems or even a possible solution to this behaviour, so we can alter our linker-scripts to make it work.

Sincerely Wolfgang


majenko

Mon, 04 Mar 2019 21:39:35 +0000

Those chips use a "split flash" bootloader. Part of the bootloader is located in the boot sector, and part is in flash.

If you use the MX250 bootloader on the MX270 then part of the bootloader code will be in the middle of the flash memory instead of at the top end of the flash memory.

[img src=https://majenko.co.uk/i/MXMemory.png]

You need to put the right bootloader on it.


Herbmaster

Tue, 05 Mar 2019 08:25:48 +0000

I already apprehended that the issue is mainly caused by the bootloader.

I wonder where it is possible to change the used bootloader during uploading a sketch via MPIDE or Arduino.

the programming tool doesn't give the opportunity to specify the used processor

command used:

pic32prog.exe -d COM14 -b 115200

If it helps this is the error message I receive during upload:

Programmer for Microchip PIC32 microcontrollers, Version 2.1.46 Adapter: STK500v2 Bootloader Program area: 1d000000-1d1fffff Processor: Bootloader Flash memory: 2048 kbytes Boot memory: 80 kbytes Data: 133124 bytes Erase: done Program flash: .................................############################## //<-- it just stops responding here Program flash failed. //<--after disconnect stk-send: write error stk-send: write error


EmbeddedMan

Tue, 05 Mar 2019 12:26:56 +0000

Changing the bootloader on a chipKIT device is easiest and most commonly done by using an ICSP programmer like the PICKit3 or such. The Arduino IDE does not provide an interface for making this type of change.


Herbmaster

Wed, 06 Mar 2019 10:25:20 +0000

Changing the bootloader on a chipKIT device is easiest and most commonly done by using an ICSP programmer like the PICKit3 or such. The Arduino IDE does not provide an interface for making this type of change.

Thank you for clearing this out for me, I wasn’t completely sure if I had this figured out correctly.

Yesterday I already tried loading the hex file for the “Fubarino Mini 2.0” ([url]https://github.com/chipKIT32/PIC32-avrdude-bootloader/blob/master/BootloadersCurrent-hex/FUBARINO_MINI_2_0_USB.hex[/url]) from your GitHub repository using a PICkit3. After the upload to the device the bootloader started running, but when I tried to upload the sketch the outcome was the same. The upload stopped right when it reached the Bootloader section, like it would be the bootloader for the MX250.

Since I don’t have any profound knowledge in programming bootloaders, I’d like to ask if you happen to have a fitting bootloader (PIC32MX270F256D with “Fubarino” Board-config) which I could upload to the device?


majenko

Wed, 06 Mar 2019 16:19:04 +0000

Try this version. It looks like the wrong linker script may have been picked when compiling that version of the bootloader.


Herbmaster

Thu, 07 Mar 2019 08:14:58 +0000

Thank you very much for uploading this new bootloader.

Apparently, that did do the trick. :D

I am currently running some tests with extended memory usage but it looks very promising.


majenko

Thu, 07 Mar 2019 10:24:08 +0000

Excellent. And we caught it just in time. The Fubarino Mini 2 is just about go to through production programming and testing at Microchip, so they will be using this new version of the bootloader. Your feedback is much appreciated.