Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:20 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Pic32Prog mmbasic+program into a file

     Page 2 of 2    
Author Message
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2950
Posted: 12:50am 31 Jul 2019
Copy link to clipboard 
Print this post

  robert.rozee said  i'm waiting for someone to read out the firmware from a freshly programmed MX170 using a pickit3/mplab so that i can compare it to the original .hex file distributed by geoff.

unfortunately the only pickit3 i have is set up for standalone programming 1455's, and i don't want to repurpose it.


cheers,
rob :-)


G’day Rob,

Which version do you want?

Also I have found that if the PK3 holds the reset then the files compare OK, but if reset is released the firmware runs and a subsequent compare fails so running mmbasic for the first time changes something.

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 12:56am 31 Jul 2019
Copy link to clipboard 
Print this post

Any pickit3 read of the current MMBasic and a test program would be a
GREAT starting point.

THanks
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 01:19am 31 Jul 2019
Copy link to clipboard 
Print this post

We are making progress.

Sadly I have no idea what Mick is talking about so he sounds like the bloke to do the job.
I think Quazee would also like things like OPTIONS but I may be wrong.
Go for it Mick, you're the man

Peter
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 01:37am 31 Jul 2019
Copy link to clipboard 
Print this post

lets start off with a clean install, no test program. if it is possible to prevent the micromite from starting up between writing the firmware and reading it back, that would be good.


cheers,
rob :-)
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 01:54am 31 Jul 2019
Copy link to clipboard 
Print this post

I will stand to one side and watch you clever young blokes do your thing.

Peter
 
led-bloon

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 207
Posted: 09:53am 31 Jul 2019
Copy link to clipboard 
Print this post

Here tis...
My Google Drive Links:
https://drive.google.com/file/d/1Ql-GTP0XzvLXbBnCmY5Rqo_8KrSB07pP/view?usp=sharing
https://drive.google.com/file/d/1l8kTqaR94igWezQcCvIaHG6fOipyumUC/view?usp=sharing
Let me know if you have a problem
led
Miss you George
 
led-bloon

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 207
Posted: 10:33am 31 Jul 2019
Copy link to clipboard 
Print this post

Link to zip of 3 individual bin files read using pic32prog.exe

https://drive.google.com/file/d/1qsZmqD6eKtHhN-Vz-w7zlDVGhm5HSo9H/view?usp=sharing

led
Miss you George
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 12:21pm 31 Jul 2019
Copy link to clipboard 
Print this post

excellent. to read the whole of MX170 memory use:

pic32prog -d ascii:com4 -r prog.bin 0x1D000000 0x3FFFF
and
pic32prog -d ascii:com4 -r boot.bin 0x1FC00000 0x00BFF

note that the first line reads 256k of program flash, and the second lines reads 3k of boot and configuration flash.

you will then need to use the specifications here:
https://en.wikipedia.org/wiki/Intel_HEX
to turn this back into a .hex file.

use 'extended linear addressing' (04h) for each of four 64k segments:
:02 0000 04 1D00 DD
:02 0000 04 1D01 DC
:02 0000 04 1D02 DB
:02 0000 04 1D03 DA
and for the 3k boot and configuration segment:
:02 0000 04 1FC0 1B

data following should be 16-byte records of type 00h:
:10 0000 00 2C1400A0C4C1029DE050039DBC51039D 6F
:10 0010 00 45BB019D28AD019DE0A8019DF4AC019D 6B
:10 0020 00 FCAF019D24B0019D44B0019D2001019D C4
....
:10 FFF0 00 1400B0AF2400BFAF2000B3AF1800B1AF 02
(the above represents a 64k block from 0000h to FFFFh)

and finally the .hex file should end with an 01h marker:
:00 0000 01 FF

you'll need to calculate the chacksum to go at the end of each data line, as per the above link. for the 04h and 01h records this checksum is already shown.


cheers,
rob :-)
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 12:23pm 31 Jul 2019
Copy link to clipboard 
Print this post

oops, forgot to mention - the spaces in the above lines are to make it easier to read. don't put spaces in the .hex file!


cheers,
rob :-)
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2950
Posted: 01:35am 03 Aug 2019
Copy link to clipboard 
Print this post

Hi All,

Sorry for the delay, I didnt get any notification that there were any replies.

If not too late here are a bunch of test burns of a PIC32MX170F256B with ver 5.5.01 programmed and read with a PicKit3.


PicKit3 Burns.zip


The file contains:


Micromite_V5.05.01.hex 'Geoffs Original Distro

Held Reset.hex 'Read of clean burn but hold RESET (IPE Option) after burn

Release Reset.hex 'Read of clean burn release RESET (allows MMBasic to run/init)

With Short Program.hex 'Read of clean burn plus a short demo code.




Kind Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 04:55am 03 Aug 2019
Copy link to clipboard 
Print this post

Thanks Mick


It will be a few day before I can make use of them. The project that got
me looking into this is now in the assembly stage. Trying a new way to
solder the SMD parts and It's not bad at all.

My new best friend



and a few pic's of the work we did today.



there are two layers 20 sets of 3.



This my 2nd best friend.

And I needed to add a new test to the code with this cheat.



Pic's are from my phone and it has a mind of its own on orientation.


So glad I found this forum has make work FUN and a lot easier.

Well back to work

Thanks again Glenn is a GREAT job you've done and are doing.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 02:31pm 04 Aug 2019
Copy link to clipboard 
Print this post

here is something to create a .hex file from two .bin files:
read pic32.zip

1. unzip into a directory, along with a copy of pic32prog.exe;

2. run ports.bat to identify the port that your micromite is attached to, and edit read.bat to match;

3. run read.bat and press the 'select' button on the 1455 adapter to enter programming mode (not needed with a nano-based programmer), then press the any key to read program flash. repeat for boot/config flash. bin2hex.exe will then run and combine the two binary files into a single 'intel.hex';

4. program 'intel.hex' into a blank MX170.

note that reading takes a LONG time, for me it was around 15 minutes. for the MX470, etc you'll need to edit the flash sizes specified in read.bat.


cheers,
rob :-)
Edited 2019-08-05 00:33 by robert.rozee
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 12:27am 05 Aug 2019
Copy link to clipboard 
Print this post

Thanks rob. I found a link you might find useful. Now more and more programs
can be run in Widows and Linux.

Delphi 10.2 Tokyo
Edited 2019-08-10 11:42 by Quazee137
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 01:44am 10 Aug 2019
Copy link to clipboard 
Print this post

Rob can you give me a kinda sudo code for the pascal or links to the library's
you used so I can see what they do? I'd like to give it a go in MMBasic.

Also thinking of trying to use lazarus and fpc. Been years since I used Delphi
on a 286/386 system and apx 20 years when I used Pascal MT+ on a CP/M system.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 11:48am 10 Aug 2019
Copy link to clipboard 
Print this post

hi,
the entire source to bin2hex is in the file bin2hex.dpr in the above archive. there are no other libraries used, aside from the standard ones that are part of delphi (i use delphi 5 professonal).

the code essentially does the following:
1. open the file "intel.hex" as output

2. open the file "prog.bin" as input and sets the variable address to 0x1D000000
3. in a loop until eof:
...a. if the lowest 16-bits of address=0 then write an "Extended Linear Address" record,
...b. read 16 bytes from "prog.bin" (incrementing address as we go) and write a "data" record encoding those 16 bytes

4. open the file "boot.bin" as input and sets the variable address to 0x1FC00000
5. in a loop until eof:
...a. if the lowest 16-bits of address=0 then write an "Extended Linear Address" record,
...b. read 16 bytes from "boot.bin" (incrementing address as we go) and write a "data" record encoding those 16 bytes

6. write an "End Of File" record


it should be relatively easy for someone to translate the pascal to python or C (or mmbasic for dos). once a couple of folks have verified that the solution in the above archive works, i'll create a version that is a tad more user-friendly.


cheers,
rob :-)
Edited 2019-08-11 07:53 by robert.rozee
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025