chipKIT® Development Platform

Inspired by Arduino™

upload chipkit sample by ICSP

Created Fri, 12 Jul 2013 16:41:04 +0000 by thepascalix


thepascalix

Fri, 12 Jul 2013 16:41:04 +0000

Hi at all, i want to upload my program or example program on my max32 using ICSP pin. So, i've read more topics in forum, where many peoples wnat to use the MPLAB for create code and update on chipkit. This is possible but in this way, he lost all the library provided by chipkit and in a programmation by the MPLAB, he lost the bootloader and all configuration inside on it.

In other topics and in the manual for debugging, i've read that it is possible to generate the hex file from the compilation, in such a way to use the debugging provided by the MPLAB.

So, at this point, my question is: is it possible to create a unique file composed by bootloader and a program and update on max32 by the ICSP? Or in other way, to have all the configuration setted in bootloader in my program?

another question is: if i modify the bootloader, for generate the hex file that i will upload by the ICSP, how i make it? How i build the hex file from the source file [url]https://github.com/chipKIT32/PIC32-avrdude-bootloader[/url]?

I hope that my question is more linear... Thanks for your help


EmbeddedMan

Fri, 12 Jul 2013 16:53:45 +0000

If all you want to do is modify the bootloader, then just go ahead, make your change, compile (using MPLAB 8 and C32 v2.02) and then upload using ICSP (like with chipKIT PGM or PICKit3, etc.) Should be easy.

*Brian


thepascalix

Fri, 12 Jul 2013 17:02:51 +0000

Wow, thanks for your rapid response. So, if i want to upload also the sketches by icsp, is it possible?


EmbeddedMan

Fri, 12 Jul 2013 17:34:36 +0000

Yes, I believe it is. The trick is that normally a complete chip erase is done during ICSP programming, and you need to prevent that from happening (or it would blow away the bootloader). So you need to take the HEX file compiled from MPIDE and program it into your device without disturbing the bootloader.

Or, you can merge the sketch and bootloader hex files before you program, and then you can do the whole-chip erase as normal.

*Brian


thepascalix

Mon, 15 Jul 2013 10:39:24 +0000

Hi, what you mean for merge files? Can i copy the entire hex file's content of a program and paste it in append to the content of the bootloader file (a simple copy and paste)?


EmbeddedMan

Mon, 15 Jul 2013 17:18:50 +0000

No, unfortunately you can't do it that way. However, this is a really cool and easy to use tool to handle merging hex files. It's called HEXMATE, and you can get a copy here : [url]http://www.schmalzhaus.com/Tools/HexmateInstructions.html[/url]

*Brian


thepascalix

Thu, 18 Jul 2013 08:17:17 +0000

Hi Embeddedman, excuse if i response only now. I've follow your instruction and in first step, i think that my changes in bootloader code have been fruitful. Only a curiosity about this. I've downloaded the standard compiled bootloader's hex file for MAx32 and it is about 19K (arduino-bootloader.X.Max32 downloaded from

http://www.digilentinc.com/Data/Products/CHIPKIT-MAX32/arduino-bootloader.X.Max32.zip

) while the bootloader that i compiled from the code is only 8 K. There are any difference??

P.S. to users in chipkit forum In my coutry, Italy, in this case, we use this words to say how i be thankful for your help and how much important was your instruction for me to resolve my problem : "Vi devo fare una statua", in english "i'll make a statue for you". Thanks for all


jmlynesjr

Thu, 18 Jul 2013 15:56:19 +0000

Is this process something that someone who does this on a regular basis could turn into a complete tutorial and repost or put on the wiki? My interest is from the fact that on the DP32 the pin reassignment can only be done from MPLAB/MPLABX(which I have never used) not from MPIDE(as stated in the DP32 Reference Manual - page 7). I'd like access to multiple timers. Gotta buy a programmer.....

James

P.S. I love reading the posts from across the pond and parts even farther east. Your English is always 100% better than I could ever do in your native language. In am trying to learn a little Spanish an it's not pretty! :D


majenko

Thu, 18 Jul 2013 16:31:26 +0000

You don't need to learn spanish. Learning languages is redundant now, with smart phones and Google translate ;)


jmlynesjr

Thu, 18 Jul 2013 17:02:27 +0000

Yes, I do have a good Android translator.

But, the real reason is that my wife is an ER Nurse with many Spanish only speaking clients. So, I am helping her with a Spanish for Health Care Providers class. It's fun. She uses/practices it every day and will pass my ability soon. :)

James


EmbeddedMan

Thu, 18 Jul 2013 19:31:38 +0000

Yes, there is a difference. Some of the guys from Digilent may need to correct me here, because I'm not 100% sure of this, but I think I'm close.

The smaller bootloader image you get from the GitHub bootloader repo is the result of Keith from Digilent doing an amazing re-write of the original bootloader. It uses 16-bit instruction mode rather than 32 to save on Flash space, and is thus much smaller. I believe that the bootloader images on the Digilent website are still the older, larger bootloaders.

*Brian


caroper

Fri, 19 Jul 2013 11:19:20 +0000

Is this process something that someone who does this on a regular basis could turn into a complete tutorial and repost or put on the wiki? My interest is from the fact that on the DP32 the pin reassignment can only be done from MPLAB/MPLABX(which I have never used) not from MPIDE(as stated in the DP32 Reference Manual - page 7). I'd like access to multiple timers. Gotta buy a programmer.....

You should never read the Manuals, they just get in the way of experimentation :)

You CAN remap everything in MPIDE, Digilent have pre defined some things in the Board Definition files but they can all be overridden.

Take a reed through my Blog post here: [url]http://caroper.blogspot.sg/2013/06/peripheral-pin-select-pps.html[/url] and the subsequent ones for practical examples.

I have even used it to reallocate the UART2 pins in place of I2C as they are 5V tolerant. [url]http://caroper.blogspot.sg/2013/07/in-this-post-we-make-start-with.html[/url]

Cheers Chris


jmlynesjr

Fri, 19 Jul 2013 13:08:31 +0000

Chris:

Thanks for the update on PPS. I found a reference to PPS and MPIDE in a Fubarino Mini reference manual yesterday. And Majenko found the function calls and pin defs by scanning the code. Looks like I can do what I need to do now. Still deciding between the DP32 and Fubarino Mini. More docs still to review. Software Archaeology...

Hopefully the reference manual will get an update.

James

Update1: Excellent blog posts! Thanks again.


EmbeddedMan

Fri, 19 Jul 2013 13:53:15 +0000

Yes, the Fubarino Mini ref manual is sorely in need of more information and text describing how all of the PPS stuff works. We're struggling a bit with the best way to present the information and make it easy to understand. If you have any ideas, or want to take a crack at it, we'd love to have more ideas.

Thanks-

*Brian


majenko

Fri, 19 Jul 2013 14:00:55 +0000

I'm pondering the idea of a PPS plugin for UECIDE - it presents you with a picture of the board and dropdown list on all the remappable pins with possible functions to choose from - press a button and it populates your setup() function for you.


jmlynesjr

Fri, 19 Jul 2013 14:28:22 +0000

Brian:

Actually I was referring to the DP32Reference Manual. It needs some work, too.

However, I will be glad to submit anything that comes to mind after I get through the FMini manual and all of Chris' blog posts mentioned above.

I appreciate all of the feedback on this topic.

James


jmlynesjr

Mon, 22 Jul 2013 19:38:28 +0000

I've now had a chance to read all(9) of Chris' blog posts, the PPS chapter of the MX250 datasheet, the Fubarino Mini manual, the DP32 manual and probably a few other things that I don't recall at the moment. It seems that a 3D display and a VR glove might be necessary to understand all of the PPS options.

Seriously, the Fubarino Mini manual could use something similar to the table in Chris' post "Peripheral Pin Select(PPS)" tailored to the 44pin version of the MX250 used by the Mini(a non-trivial effort). And also a complete list of all the peripherals and all of the re-mappable peripherals. I.e. I2C can not be remapped. This info should be made more clear in the datasheet as well.

Chris, if you are listening... In your "PPS Continued and a Plunge into the Dark Art of Register Manipulation" post, you indicate that you are going to output Posc. The code is outputting the Reference Clock(0011), and the code discussion is referencing Posc(0010). Minor typo if you'd like to make the update.

I cross referenced Chris' table against Table 11-1 and Table 11-2 from the datasheet and it seems that PPS_IN_SS1 and PPS_OUT_SS2 are missing from Chris' table.

I also pulled together a BOM for a minimal breadboard version and it looks like about $15.50 USD( one-off part prices from Digi-Key) assuming that I don't have anything on-hand verses $19.99 USD for the Fubarino Mini. I don't have wire wrap tools at the moment, so I am ruling out the DP32 for now.

James


majenko

Mon, 22 Jul 2013 19:43:19 +0000

I'd just like to quote Serge Vakulenko from an email to me a bit back:

Looks like PPS was added to mx1/2 at the last moment of a chip design, when it was too late, so only a limited capabilities remained for additional routing. It was promised that pic32mz will have a full PPS (and also a 5v tolerance on all pins). Though I doubt mz will be available in DIP package.


caroper

Mon, 22 Jul 2013 20:42:10 +0000

Thanks James,

I will cross reference those typos and correct them.

We were having a few renovations done last week so, I have only just got the network reconnected and my work bench set up, (though still covered in stuff still to be stored), But hopefully I will be productive again from tomorrow and update the blog with some new experiments.

Cheers Chris


jmlynesjr

Tue, 23 Jul 2013 17:51:33 +0000

What's the schedule for the PIC-MZ flavor?

A full crossbar/matrix "switch" and complete 5v tolerance would be very nice.

James

FYI: the pre-programmed mx250s are on backorder from Microchipdirect. I ordered 3 yesterday and they will ship from Thailand the first week of August. Still not bad.