PIC32MX440F512 bootloader help?

EmbeddedMan
Posts: 583
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: PIC32MX440F512 bootloader help?

Postby EmbeddedMan » Thu Dec 06, 2012 3:19 pm

So if you build the MX4-USB project in MPLAB 8, without any changes, it fails to build? That's strange.

I just downloaded a fresh copy to my machine, and after setting the build tool location properly (the project, as it stands in Github right now, has the tool location specified in the project file - uncheck that from the Project->Select Language Toolset dialog box and make sure you have C32 v2.02 installed) and it built just fine for me.

Maybe it's using the wrong compiler? You need to use C32 v2.02 with this code.

*Brian

EmbeddedMan
Posts: 583
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: PIC32MX440F512 bootloader help?

Postby EmbeddedMan » Thu Dec 06, 2012 3:23 pm

Jimstrong wrote:Dear Brian, I have further investigated the problem, now I changed the boarConfig.h as the following:

2. Do the virtual program button and the button has to be the same port?


Yes, I think they do. Just use whatever I/O pin your PRG button is connected to. You need a PRG button if you're using USB as your communication method back to the PC.

Jimstrong wrote:3. In the project, I compliled main.c and it is successful. But if I build all by right click in the project name, it has some errors. The first one is

/BoardConfig.h:1377:6: #error Board/CPU combination not defined

Please help.


Well, if you probably created a new board define for the section in the BoardConfig.h file for your board, right?

In otherwords, instead of
#elif defined(_BOARD_CHIPKIT_UNO32_)
you have
#elif defined(_BOARD_JIMSTRONG_BOARD_)

correct?

Then you need to go into the build options and remove the existing preprocessor macro in the MPLAB PIC32 C Compiler tab and add in the new macro (_BOARD_JIMSTRONG_BOARD_).

See if that helps.

*Brian

Jimstrong
Posts: 17
Joined: Tue Dec 04, 2012 4:22 am

Re: PIC32MX440F512 bootloader help?

Postby Jimstrong » Fri Dec 07, 2012 3:15 am

Dear Brian,

after changing the C32 compile version to 2.02, I sucessfully build all the boot loader in to the PIC32MX440512H.

I have also blinked the LED via mpIDE on the board through the USB port. Many thanks.

One thing is that in this bootloader, when first powered on or reset button is pressed, the down load LED is half bright while the boot LED would blink 2-3 seconds and then goes off. After that, the real program starts to blink the LED.

A similar thing is that at power up or reset, the com port in the device manager pop up once and disappear. I need to press the reset and pull down PROG for the com port to appear.

Is this due to some setup during the bootloader?

Thanks for all your past help. I do appreciate it!

Jimstrong

EmbeddedMan
Posts: 583
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: PIC32MX440F512 bootloader help?

Postby EmbeddedMan » Fri Dec 07, 2012 4:36 am

Wow! That's great news. I'm really glad you got it working.

About the strange LED behavior and needing to reset - no, I don't think that's how it is supposed to be. I think there may be something wrong with the way it's detecting if it needs to be in bootloader mode or not on your board. Maybe something to do with the virtual program button? On the Fubarino SD (which is also 440 USB based) this problem does not happen.

*Brian

Jimstrong
Posts: 17
Joined: Tue Dec 04, 2012 4:22 am

Re: PIC32MX440F512 bootloader help?

Postby Jimstrong » Fri Dec 07, 2012 5:12 am

The LED is behavior is like this.

When I only burn the the bootloader and plug the USB to the board, it will keep in bootloader mood.

After i burn the Blink LED through mpIDE, it has the strange behavior. When power up or reset, it first stay in bootloader mode for 2-3 seconds, the begin to blink the LED.

I guess as long as I can burn program, I will live with this for now.

Thanks Brian.

Jim

EmbeddedMan wrote:Wow! That's great news. I'm really glad you got it working.

About the strange LED behavior and needing to reset - no, I don't think that's how it is supposed to be. I think there may be something wrong with the way it's detecting if it needs to be in bootloader mode or not on your board. Maybe something to do with the virtual program button? On the Fubarino SD (which is also 440 USB based) this problem does not happen.

*Brian

EmbeddedMan
Posts: 583
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: PIC32MX440F512 bootloader help?

Postby EmbeddedMan » Fri Dec 07, 2012 4:24 pm

Yeah, that's not right. When using the USB bootloader, it should ONLY go into the bootloader (and thus connect to the PC as a serial port for bootloading) if you have the button pressed as you reboot, OR if the virtual button is set in software and a software reset is executed.

The "go into bootloader mode every time you are reset for 2 seconds" thing is how the USART bootloader works. Maybe you still have the UART section of code turned on?

*Brian

Jimstrong
Posts: 17
Joined: Tue Dec 04, 2012 4:22 am

Re: PIC32MX440F512 bootloader help?

Postby Jimstrong » Fri Dec 07, 2012 5:05 pm

Brian,

I have commented the following code:
# define _USE_UART1_FOR_BOOTLOADER

So I do not think I turned on the UART code.

The other thing is that the USB port does not connect to the UART port via FTDI cihp, it connects to the USB module directly. Will this cause some problem?

Jim

EmbeddedMan wrote:Yeah, that's not right. When using the USB bootloader, it should ONLY go into the bootloader (and thus connect to the PC as a serial port for bootloading) if you have the button pressed as you reboot, OR if the virtual button is set in software and a software reset is executed.

The "go into bootloader mode every time you are reset for 2 seconds" thing is how the USART bootloader works. Maybe you still have the UART section of code turned on?

*Brian

EmbeddedMan
Posts: 583
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: PIC32MX440F512 bootloader help?

Postby EmbeddedMan » Fri Dec 07, 2012 5:58 pm

Jim,

No, that's only way it can work - a direct USB connection from the PIC32 to the PC.

Hmm. I'm not really sure why you're seeing the strange behavior.

*Brian

Jimstrong
Posts: 17
Joined: Tue Dec 04, 2012 4:22 am

Re: PIC32MX440F512 bootloader help?

Postby Jimstrong » Sat Dec 08, 2012 4:35 am

Now I think the LED behavior is right.

When first burn the bootloader, only one LED will blink, indicating it's in bootloader mode. Once I program the chip in via mpIED, it directly starts the programe without any strange behavior.

I have changed nothing. Very strange. But I am glad that I got it done in one week.

Thanks, Brian. Have a nice weekend.

Jim
EmbeddedMan wrote:Jim,

No, that's only way it can work - a direct USB connection from the PIC32 to the PC.

Hmm. I'm not really sure why you're seeing the strange behavior.

*Brian


Return to “IDE Integration”

Who is online

Users browsing this forum: No registered users and 4 guests