Strange event using USB HID bootloader on PIC32MX795F512l

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Strange event using USB HID bootloader on PIC32MX795F512l

#1 Post by Rotary_Ed » 15 Oct 2019 22:54

I have encountered a strange event 3 times (out of hundreds) when using the USB HID bootloader app. I program the chip using the programmer with the USB HID bootload code. Then I connect a micro b USB plug to the onboard socket and attempt to load the application code. Here is what happened on the 3 events in question .

Normally, the first step is that the USB HID app erases the chip. This is shown by a green status bar on the bottom of the app. Normally, the green bar goes approx. 1/10 of the way across its range, then pauses for a fraction of a second and then the green bar rapidly extends further to the left completing the erasure. Then the green progress bar starts indicating the loading of the application code with a sort of jerky progress as it progresses. Then the chip resets and the display lights up and all is good.

On the 3 cases in question, the erase cycle acts differently. Instead of the initial spurt and hesitation and then completing, the green bar simply very rapidly (can hardly detect with the eye) completes the trip from left to right Then when the app code is being loaded, the progress is more rapid than normal without the jerky progress- but otherwise seems to complete. However, the code loaded to the chip will not run.

Now if I take the chip and use the programmer to load the same app code directly, the chip and code works fine.

Does anyone have a clue as to what the problem might be. I can use load the bootload code to a different PIC32MX795F512L and everything works fine. At a lost.

Thanks
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Strange event using USB HID bootloader on PIC32MX795F512

#2 Post by Rotary_Ed » 16 Oct 2019 16:50

Using the programmer to reads the chip after downloading the USB HID bootloader code reveals the problem.
The first screen shows the chips boot area with good USB HID bootload code.
Good bootload code.jpg
Good bootload code.jpg (102.32 KiB) Viewed 2266 times

The second screen shows the affected chip read after loading the USB HID code to the chip. The bootload code simply is not there and that explains why when the program code is loaded using the USB HID App it does not run. Actually despite what the USB HID App indicates, it appears no program code is loaded at all. At least when I use the programmer to read the loaded program code - there is none on the chip.
Bad  bootload code.jpg
Bad bootload code.jpg (113.82 KiB) Viewed 2266 times
Since the code and boards are the same the only conclusion I can come to is that the chip has a defect that prevents loading the boot area. The chip will run fine if the program code is loaded using the programmer. It only when trying to load the USB HID Bootloader code that there is a problem - once again indicating some flaw in the boot area of the chip - my best guess.


Just wanted to share in case anyone else encountered the same problem.
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Strange event using USB HID bootloader on PIC32MX795F512

#3 Post by Rotary_Ed » 17 Oct 2019 15:53

Still do not know the cause, but was able to finally get the boot section of the affected chip programmed with the USB HID bootload code.

I took a board with a chip that had programmed successfully with the USB HID bootload code and then read the code and bootcode from that chip back to the programmer. Then without reloading the program code from the compiler, I simply wrote the code downloaded from the good chip to the "bad" chip. For whatever reason, this worked. I was then able to successfully use the USB HID app to load program code to the affected chip thereafter.


But still no understanding why this worked and the normal method did not.
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

VCC
Posts: 463
Joined: 08 Jun 2009 18:31
Location: Romania

Re: Strange event using USB HID bootloader on PIC32MX795F512

#4 Post by VCC » 17 Oct 2019 17:18

Hi,
can you confirm that the oscillator for the "bad" chip/board is stable enough to meet timings for writing to flash? Just an idea.

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Strange event using USB HID bootloader on PIC32MX795F512

#5 Post by Rotary_Ed » 17 Oct 2019 17:57

Good point,

I'll hook up my oscilloscope and see what I can determine about stability of oscillator. Will let you know.
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Post Reply

Return to “mikroPascal PRO for PIC32 General”