Created Thu, 02 Feb 2012 07:11:59 +0000 by knChip
Thu, 02 Feb 2012 07:11:59 +0000
Hi, I have complied code using Microchip MPLAB IDE. What command line option to be used to download the .hex file to chipKIT MAX32?
I tried like this : avrdude -c Arduino -P com18 -b 115200 -t -ppic32
The download LED on MAX32 blinks , but the output is as follows
avrdude: stk500_getsync(): not in sync: resp=0x00
Thanks, knChip
Thu, 02 Feb 2012 16:22:25 +0000
The only way you can use AvrDude is if you compile from within MPIDE. If you want to upload via MPLAB, you must use a picKIT3 or the like debugger for the Max32 and Uno32. However, the MX7cK, MX4cK, and MX3cK can be programmed directly from MPLAB without a picKIT3 via the DGB USB connector.
If you need more information, let me know what board you are using, what version of MPLAB, and if you are using MPIDE.
Thu, 02 Feb 2012 17:52:44 +0000
[color=#0000BF]> If you need more information, let me know what board you are using, what version of MPLAB, and if you are using MPIDE.
[/color] I am using chipKIT MAX32. I have compiled some program from MPLAB IDE and got test.hex file . I have tried to run the Avrdude from command prompt from my windows 7. I am able to download hex files for other Arduino board(I mean Arduino NG ) by this method by using Arvdude using the option -U:w:test.hex. But due to some reason MAX32 timesout. Why?
Are you saying that we cannot upload any hex file to chipKIT max 32 using command line version of Arvdude?
Once if I am able to upload the hex file, next step is to make sure that the application binary is compatiable with the ARduino bootloader. If this sequence is possible, we have a powerful board and powerfull IDE combination.
Fri, 03 Feb 2012 15:11:16 +0000
On the plus side, I have managed to flash hex files onto the chipkit with avrdude. You need to use the config file which comes with mpide. (I also used the copy of avrdude which comes with mpide).
The command I used (on linux) is: ~/mpide-0023-linux32-20111221/hardware/tools/avrdude -C~/mpide-0023-linux32-20111221/hardware/tools/avrdude.conf -v -p32MX795F512L -cstk500v2 -P/dev/ttyUSB0 -b115200 -D -Uflash:w:test.hex
Hopefully this works for you. You might need to press the reset button just before you run avrdude.
On the downside, I have only successfully flashed other people's hex files, or hex files produced by mpide. When I compile a hex file with mplab x, it will upload to the chipkit but the program does not run as expected. Does anyone have a simple example mplab x project which will make a good hex file that works on the chipkit?
Fri, 03 Feb 2012 16:00:12 +0000
I think you will spend a lot of time on this with little success. The reason is that MPLAB will put both config bits in the .hex file as will as their bootloader. MPLAB does not know about the MPIDE bootloader which is already installed on the Max32. Likewise the config bits for the Max32 is provided by the bootloader pre-installed on the Max32, not coming from the .hex file.
So you see, you are trying to make a cake with the ingredients of a pie. I am not saying you can't do it, I'm saying you will need to understand both MPLAB and MPIDE and how they load programs to get it to work.
If you are going to use MPLAB, get a picKIT3 and let MPLAB load the program, if you are going to use MPIDE, then let avrdude load the program.
Fri, 03 Feb 2012 17:51:04 +0000
Actually, it's really easy to get MPLAB to NOT put config bits in the HEX file. We do it all the time for UBW and UBW32 firmware, since we have the USB HID bootloader (with the config bits) already programmed on there.
The trick here is for somebody to take a procdefs.ld file from the USB HID bootloader based firmware projects and modify it such that it outputs code in the right places so that we can upload the resulting HEX file using Avrdude to the chipKITs with the bootloader.
I can take a look at this to see how hard it would be - on the surface, it seems really simple . . . .
*Brian
Fri, 03 Feb 2012 18:49:42 +0000
I can take a look at this to see how hard it would be - on the surface, it seems really simple . . . . *Brian
On the surface, a pic32 seems like a little black piece of plastic. . . . :)
Fri, 03 Feb 2012 19:15:49 +0000
Ha ha! That's pretty funny danc c. Very good!
*Brian
Fri, 03 Feb 2012 21:15:41 +0000
OK, I got it all working. But I'm not really a command line guy, so I just did it as a post-build step within MPLABX.
See this page for the quick how-to: [url]http://www.chipkit.cc/wiki/index.php?title=Avrdude_and_the_chipkit[/url]
In order to create the proper hex file, you need to add the proper linker script from the \hardware\pic32\cores\pic32 (for example, chipKIT-MAX32-application-32MX795F512L.ld) and copy it to your MPLABX project file, then add it to your Linker Files folder in the Projects window. Then when you build, your project will be build so that it can be uploaded using avrdude to a chipKIT board.
*Brian
Fri, 03 Feb 2012 23:32:34 +0000
The only way you can use AvrDude is if you compile from within MPIDE. If you want to upload via MPLAB.
Actually its pretty easy to use AvrDude outside of MPIDE. If you want to see the exact command line MPIDE sends to AvrDude you can hold down shift when uploading to the board and the verbose will be engaged. The hardest part to so stop the upload process as soon as it starts so the string doesn't scroll out of the window buffer.
I've also been able to use this information to reconfigure a standalone AvrDude GUI tool to upload hex files to a PIC32. I've attached the avrdude gui tool modified to work with PIC32 to this post.
Here is a link on how to use it with the PONTECH UAV100 (ArduPiolt clone) using a PIC32.
Jacob
Sat, 04 Feb 2012 04:44:36 +0000
Hi, Perfect, this was the infomation I was looking for ... Thanks Jacob Christ and EmbeddedMan . I have tried the tool supplied by Jacob and it is great. I could read/program the chipKIT MAX32.
Thanks and regards, KnChip
Sat, 04 Feb 2012 14:52:35 +0000
Brilliant! This seems to work for me too (I've only tested with a very simple program so far). Thank you very much for the help.
Sun, 05 Feb 2012 05:54:14 +0000
Brian, I tried to imclude the linker file to the starter kit project folder, added it to the project. While I build the project it reports error as follows. It detects syntax error in the linker script. The script I have copied from build
Make: The target "C:\Microchip Starter Kits\PIC32 Starter Kits\Starter_Kit_Tutorial.\Objects - PIC32 Starter Kit\starter_kit_tutorial - PIC32 Starter Kit.elf" is out of date. Executing: "..\MPLAB C32 Suite\bin\pic32-gcc.exe" -mprocessor=32MX360F512L "Objects - PIC32 Starter Kit\starter_kit_tutorial.o" -o".\Objects - PIC32 Starter Kit\starter_kit_tutorial - PIC32 Starter Kit.elf" -Wl,-L"..\MPLAB C32 Suite\lib",-L"..\MPLAB C32 Suite\pic32mx\lib",--script="D:\freeRTOS_experiment\FreeRTOS\Demo\PIC32MX_MPLAB\chipKIT-MAX32-application-32MX795F512L.ld",--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,-Map=".\Objects - PIC32 Starter Kit\starter_kit_tutorial - PIC32 Starter Kit.map" ..\MPLAB C32 Suite\bin..\lib\gcc\pic32mx\3.4.4........\pic32mx\bin\ld.exe:D:\freeRTOS_experiment\FreeRTOS\Demo\PIC32MX_MPLAB\chipKIT-MAX32-application-32MX795F512L.ld:439: syntax error Link step failed
Mon, 06 Feb 2012 05:05:25 +0000
On line 439 (the place where you're getting the error) is the first use of the
PROVIDE_HIDDEN
directive. I don't know enough about the C32 compiler to know when that got introduced. But I'm using C32 v2.02 from within MPLAB X, and it has no problem with that line.
What version of C32 are you using?
*Brian
Mon, 06 Feb 2012 09:37:17 +0000
version v 1.10, I have downloaded the latest starter kit and installed, but not sure why the compilder did not get updated to the latest, though it claimed to be having compiler version 2.1 . That is another story..
I tried with the compiler which is shipped with MPIDE and the code is compiling without error with the linker script. When I uploaded the file to the chipKIT max32, the LED blinking application has not seen working. I have to debug further. I have applied blinking code to pin 13 which is RA3.
narayanan
Mon, 06 Feb 2012 13:53:31 +0000
Hmm. I have not tried with any compiler other than C32 v2.02.
Download that (www.microchip.com/C32) and give it a try and see if it solves the problem.
Note that the compiler that comes with MPIDE is not exactly C32 v2.02. Pretty close, but not exactly the same.
*Brian
Mon, 06 Feb 2012 15:54:39 +0000
If you want to see the exact command line MPIDE sends to AvrDude you can hold down shift when uploading to the board and the verbose will be engaged. The hardest part to so stop the upload process as soon as it starts so the string doesn't scroll out of the window buffer. Jacob
Good Job at figuring out how to do this the easy way... when you think about it, of course.
As for Jocob's scrolling problem; if you just select a bogus COM port in MPIDE, avrdude will fail and scroll much slower so you can more easily copy the avrdude command line.
Tue, 07 Feb 2012 21:51:32 +0000
Anyone tried this:
This is a port of Geoff's Maximite Basic to the chipKIT MAX32 Board Works with the built in bootloader you will have to flash it using avrdude at a command line avrdude -C /opt/local/etc/avrdude.conf -c stk500v2 -P /dev/tty.usbserial-A5004FpV -p pic32 -b 115200 -U flash:w:Maximite-2.5-ksd-ChipKit-Max32.hex:i -v
I tried running this on a windows system, on a Linux system and on a OSx system. Nothing worked. All system had a perfect hanger until I kept up MPIDE running as the directories with the hex files vanish if you close the IDE.
I think i just spent time for lulu. It is a pity that people never really explain what they do so others could participate.
Thu, 09 Feb 2012 10:15:15 +0000
**> [b][[color=#0000BF]EmbeddedMan"]Hmm. I have not tried with any compiler other than C32 v2.02. Download that (http://www.microchip.com/C32) and give it a try and see if it solves the problem. Note that the compiler that comes with MPIDE is not exactly C32 v2.02. Pretty close, but not exactly the same. *Brian
[/color]**[/quote][/b]Hi ALL, I am able to compile the project from MPLAB and upload to chipKIT MAX32 using AVRDUDE GUI tool.
Thanks and regards, Narayanan
Fri, 10 Feb 2012 10:59:41 +0000
I think i just spent time for lulu. It is a pity that people never really explain what they do so others could participate.
What do you mean by this statement? What do you feel has not been explained?
Jacob