Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:29 17 Sep 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 : simplest 32MX150 ICSP

     Page 5 of 28    
Author Message
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2956
Posted: 01:42pm 05 May 2014
Copy link to clipboard 
Print this post

Lads,

If it takes an hour or so running in basic from a MM or CMM it wouldnt matter to the home hobbiest.

But, why not create a 'special' HEX file that can be flashed into the MM or CMM and use it to programme the uMite. Then when finished just flash the latest firmware back into the MM CMM. All up it should only take about 5 min and almost anyone could do it.

Of course it requires someone to write a HEX to flash into the MM/CMM in the first place but if the algorythms and timings are 'out there' it shouldnt be (famous last words) that difficult to write a firmware tondonthe job in C.

Says Mick, now ducking for cover..


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

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 02:08pm 05 May 2014
Copy link to clipboard 
Print this post

A "little" bootloader in the user flash space, which then will write the bigger hex file at "normal" speeds. But this depends on Geoff as I'm afraid that there are some problems with the code generated by different compilers.
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 02:22pm 05 May 2014
Copy link to clipboard 
Print this post

  vasi said   A "little" bootloader in the user flash space, which then will write the bigger hex file at "normal" speeds. But this depends on Geoff as I'm afraid that there are some problems with the code generated by different compilers.

The joys of 'C' (depending on third party software) and why I avoid it!
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 03:16pm 05 May 2014
Copy link to clipboard 
Print this post

Hi fellas,

I need two funtions (well, probably more actually). One to convert a 4 nybble hex string to an integer value and another to convert a Hex Char to a binary string.

This is what I've come up with so far. Does anyone have a better/faster/shorter way?

I tested with this bit of code. I will need to make the Hex to Binary cater for 4 nybbles. That should be fairly easy.

Print hextodec("ffff")
Print hextobin$("9") + hextobin$("a")
End


The result I got was:

65535
10011010
>


Function hextodec(st$)

Local x,y,hexbyte,char$
hexbyte = 0
For x = 1 To Len(st$)
char$=Mid$(st$,x,1)
y = Instr(1,"0123456789abcdef",char$)
hexbyte = hexbyte Or (y-1)
If x < Len(st$) Then hexbyte = hexbyte*16
Next x
hextodec = hexbyte
End Function

Function hextobin$(nibble$)
Local bit,bin_count,dec_val,nibbles,byte$
byte$=""
bin_count = 8

dec_val = Instr(1,"0123456789abcdef",nibble$)-1

For bit = 1 To 4
If dec_val >= bin_count Then
byte$ = Byte$ + "1"
dec_val = dec_val - bin_count
Else
byte$ = byte$ + "0"
EndIf
bin_count =bin_count / 2
Next bit
hextobin$ = byte$
End Function


If anyone wants to come up with a different way of programming a blank PIC32 other than by MM, perhaps a parallel thread would be better. My aim is to use the MaxiMite and MMBasic to programme the microMite and to see just how fast or slow it is.

==============

forgot to mention that all testing is being done on the microMite - because it is plugged in and going.Edited by MOBI 2014-05-07
David M.
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2956
Posted: 03:32pm 05 May 2014
Copy link to clipboard 
Print this post

Lads,

Showing my ignorance here, but the MM/CMM has a boot loader built in.. It should be possible for some C programmer (no matter what C flavour they use) to write some code (NOT based on Geoff's MMBasic but stand alone code) This doesnt need any bells and whistles, it could flash an LED twice to indicate ready, then detect a switch press or wait say 30 seconds then dump its `guts' into the uMite. Flash LED say 5 times then If Verify possible, do a verify and flash 10 times if OK stay Permanent ON if NOT.

What does it matter what compiler Geoff uses? All you need to do (saying like it is simple) is write code that is stand alone for the CMM (that replaces the MM/CMM HEX file). You dont need VGA displays or keyboards etc.

Of course this is `my logic' process of the steps I would do if I could `Speak in C'... but as I cannot `speak C' it may be a naive statement.. Am I missing something here?

I realise it would NOT be a simple task, I never said it was, but I see that there are MANY C programmers out there doing so many wonderful things that I cant see how toggling a few data lines in the correct sequence could be so hard to do compared to so many other wonderful programs I see written in C.

OK, shoot me down, I am prepared for being shown the error of my ways but I only itemised this as a `possible' way it could be approached.

Preacher's hat off now,

Mick (badly bruised and beaten by all those C Speakers out there)



Edited by bigmik 2014-05-07
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 04:09pm 05 May 2014
Copy link to clipboard 
Print this post

MOBI,

I hear what you are saying in terms of wanting to use a MaxiMite to program a MicroMite; however, just wanted to know why you state using a MaxiMite rather than using a MicroMite to program a blank PIC to create a MicroMite? They both use MMBasic so see no difference.

Just curious - I am not suggesting one is better than the other!

PS datasheet N is now available re programming PIC32s

WW
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 05:02pm 05 May 2014
Copy link to clipboard 
Print this post

  WW said  I hear what you are saying in terms of wanting to use a MaxiMite to program a MicroMite; however, just wanted to know why you state using a MaxiMite rather than using a MicroMite to program a blank PIC to create a MicroMite? They both use MMBasic so see no difference.


I'm using the MM as the programmer platform because I can dump a hex file to a SD card and read the data from the hex file to dump to the PIC32. The target pic doesn't have to be a micromite nor does it have to be a MaxiMite. I have CMMs and uMites.

I guess I could input the data to the MicroMite via serial or parallel like I did from VB6 to my home grown 8 bit pic programmer.

For me, it is a bit like the parent MM giving birth to a child uM.

Anyone can pick it to pieces and do what they like with it when I'm done or along the way.
David M.
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 06:01pm 05 May 2014
Copy link to clipboard 
Print this post

I think Mick's drift is that without purchasing a PicKit3 it's a route that could be taken to flash/re-flash a MicroMite, if you already have a MaxiMite, because of the latter's internal bootloader and file-handling (and your PC/Mac/Linux machine or terminal of course). It would presumably give you good speed compared to using MMBasic and all you need is someone to write that 'C' program . But then you need someone to write the MMBasic code for the MicroMite too and that might be even trickier.
Correct me if this wasn't your 'drift' Mick.

Greg

Your reply came in while I was posting David but similar comments made - the file reading of the MaxiMite presumably makes a big difference.Edited by paceman 2014-05-07
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2956
Posted: 06:48pm 05 May 2014
Copy link to clipboard 
Print this post

Yes Greg,

You have hit the nail on the head.. That is exactly the point..

Regards,

Mick


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2447
Posted: 08:01pm 05 May 2014
Copy link to clipboard 
Print this post

no need for C code, in theory everything should be doable in just MMbasic. remember, also, that MMbasic exists for other platforms too - including Win32 and, i believe, linux. the possibility exists that, with minor additions to the Win32/linux versions, a 32MX150 could be programmed with the aid of just the MMbasic interpreter and some simple non-programmed hardware. this provides a possible path for getting MMbasic up and running on a PIC without need for a pickit3 at any point in the process.


rob :-)Edited by robert.rozee 2014-05-07
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1314
Posted: 08:09pm 05 May 2014
Copy link to clipboard 
Print this post


I feel in theory, it can be done in C or MMbasic, and on a Maximite, or a Micromite.

I'm sure, it will be done eventually.

Cheers Don...
https://www.dontronics.com
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 08:26pm 05 May 2014
Copy link to clipboard 
Print this post

  robert.rozee said   no need for C code, in theory everything should be doable in just MMbasic. remember, also, that MMbasic exists for other platforms too - including Win32 and, i believe, linux. the possibility exists that, with minor additions to the Win32/linux versions, a 32MX150 could be programmed with the aid of just the MMbasic interpreter and some simple non-programmed hardware. this provides a possible path for getting MMbasic up and running on a PIC without need for a pickit3 at any point in the process.

rob :-)

I reckon the ideal platform for this would be MM Edit. The language behind that seems to have the I/O capabilities that MM Dos lacks.

Any opinions there Jim?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6302
Posted: 09:23pm 05 May 2014
Copy link to clipboard 
Print this post

MM Edit is a text editor, not a compiler or interpreter.

If a working loader written in MMBasic is developed, I could look at incorporate it into MM Edit (or standalone).

I think it would be 'cool' (Is that expression still used?) if the Maximite and MMBasic could be used, if only to prove that it CAN be done.

If a PC is used, there would have to be some sort of hardware. Back in the good old days, a parallel port would have been ideal. USB-serial adapters do have enough handshake lines but doing decent timing under Windows is challenging.

Jim


VK7JH
MMedit
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:01am 06 May 2014
Copy link to clipboard 
Print this post

Once the programming part is figured out you could then adapt it to program a chip by sending the hex over the console.
No need for an sd card in that case.
A micromite could then program another pic.

A micromite could possible clone itself using peek to read its own content (would that be possible or are there regions that are inaccessible).


Microblocks. Build with logic.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4071
Posted: 02:38am 06 May 2014
Copy link to clipboard 
Print this post

Any working version written in any Basic ought to be fairly short and understandable. Consequently anyone writing any other version in another language would have a good template to work from.

A C version might ultimately be the fastest and I suppose POKE could be used to get it into RAM but how to CALL it? Still, we don't have the Basic one yet...

In some sense the fewer wires and the simpler the code the better for anyone wanting to understand it or convert to another language.

John
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 09:50pm 10 May 2014
Copy link to clipboard 
Print this post

  Quote  A C version might ultimately be the fastest and I suppose POKE could be used to get it into RAM but how to CALL it? Still, we don't have the Basic one yet...


Just to keep you up to date, I have been working on coding the programming algorithms and am nearly at the stage of doing a "simple" erase chip function. I should be able to check the success using PICKit3. Once I get a function working, it should be relatively simple progress from there.

Trying to weasel out just what MicroChip really meant has been a headache.
===================
(I have been rather bereft of time lately so progress is slow.Edited by MOBI 2014-05-12
David M.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2447
Posted: 02:47am 12 May 2014
Copy link to clipboard 
Print this post

MicroChip's strange logic seems to have a leaning towards not really wanting anyone else to understand the algorithms, with no real reasoning behind this desire.

like many, i'm quietly stand by with baited breath, eager to see your results!


rob :-)
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 02:57am 12 May 2014
Copy link to clipboard 
Print this post

Hi Rob,

I'm about the stage to hook up a PIC32 and see if it can accept a programmer command, but it might take a few days, we are still "evicted" from our home whilst acoustic logging is taking place.

I'll see if I can do a zip file and attach it or maybe PM you. It doesn't look much but trying to work out MC has been a bit of a headache - typical


David M.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2447
Posted: 03:09am 12 May 2014
Copy link to clipboard 
Print this post

i'm more than happy to lash up some hardware - i've a small stash of 32MX150's here and am happy to experiment on them. also a few ZIF sockets; i assume you're still running the code on a micromite? it would be neat if the 'final version' could simply be a micromite with the contents of the .HEX file streamed down the console serial port.


rob :-)
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 02:49pm 12 May 2014
Copy link to clipboard 
Print this post

If you google DS60001145M that should get you the programming data sheet for the pic32. Download it and it will be easier to discuss the algorithms and possible coding.

Yes, I'm still with uMite and will be until I am allowed back in the house and can set up the MM. Is MM going to run at the same speed as the uM? I haven't checked relative speeds out.

I'll see what I can put together tonight in the way of a programming jig and post it. Meanwhile, I bought myself a 40ton hydraulic log splitter yesterday. I got tired of swinging a "block buster" (so did the rest of the body.) I should have done it years ago. So today, I'll be out splitting fire wood.
David M.
 
     Page 5 of 28    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025