chipKIT® Development Platform

Inspired by Arduino™

Bootloader for PIC32MX360F512L

Created Tue, 17 Sep 2013 00:12:00 +0000 by Ultron


Ultron

Tue, 17 Sep 2013 00:12:00 +0000

Hi, a few question:

  1. there is a MX360F512L bootloader (MAX32 Type)?
  2. there is a RESET software instruction for reset the Board?
  3. if not exist, is possible reset with one quickly Watchdog instruction? How do?

I come from Arduino, and I recently discovered ChipKit. For Graphics (SSD1963 chip or T6963) the MAX32 board is fastest. Awesome!

Thanks

Guido from Italy


majenko

Tue, 17 Sep 2013 16:55:50 +0000

Resetting the PIC32 in software is simple when you know how. This is the code I use:

void reset()
{
    SYSKEY = 0;
    SYSKEY = 0xaa996655;
    SYSKEY = 0x556699aa;

    /* Reset microcontroller */
    RSWRSTSET = 1;
    (void) RSWRST;
}

The first 3 lines "unlock" the system to allow the reset to be requested, and must be done exactly like that. It's quite fussy about it.


Ultron

Tue, 17 Sep 2013 19:20:11 +0000

I try this simple code (in graphic project with SSD1963), but not work:

if (pressed_button==but4) reset1();*

/// at the end of file in Functions section //// Software RESET
void reset1() { SYSKEY = 0; SYSKEY = 0xaa996655; SYSKEY = 0x556699aa;

/* Reset microcontroller */
RSWRSTSET = 1;
(void) RSWRST;

}

  • The reset word is coloured from the IDE, so it means that is a reserved word. I then changed with reset1().

The code of the Button, with digitalWrite() instead reset1() function, work fine.

Note: my Board is UNO32, not MAX32. SYSKEY value it's the same?

For the first question, the bootloader for MX360F512L?

Thanks!


majenko

Tue, 17 Sep 2013 19:36:45 +0000

Just because it's coloured doesn't mean it's reserved - it means that somewhere one of the libraries may have it as a method.

This works fine on my UNO32:

void setup() {
	Serial.begin(9600);
	Serial.println("Started");
	for (int i = 10; i > 0; i--) {
		delay(1000);
		Serial.print("Resetting in ");
		Serial.println(i);
	}
	Serial.println("Resetting...");
	reset();
	Serial.println("Reset failed!");
}

void loop() {
	
}

void reset() {
	SYSKEY = 0;
	SYSKEY = 0xaa996655;
	SYSKEY = 0x556699aa;
	
	/* Reset microcontroller */
	RSWRSTSET = 1;
	(void) RSWRST;
}

I was going to point you to github for the bootloader code, but it's down at the moment - first time I've ever seen that happen.


majenko

Tue, 17 Sep 2013 19:41:21 +0000

Ah, GH is back.

Try this bootloader: [url]https://github.com/chipKIT32/PIC32-avrdude-bootloader/raw/master/bootloaders/MX3cK512.hex[/url]


Ultron

Tue, 17 Sep 2013 20:18:56 +0000

Ah, GH is back. Try this bootloader: [url]https://github.com/chipKIT32/PIC32-avrdude-bootloader/raw/master/bootloaders/MX3cK512.hex[/url]

Fantastic! Thanks very much!

Now i try your code for reset... from 5 minutes to tell you if it worked.


Ultron

Tue, 17 Sep 2013 20:32:00 +0000

Ok, sorry...

I was wrong buttonID. The reset code work fine.

Once again thank you!

Now i try the bootloader on my MX360...


Ultron

Thu, 10 Oct 2013 20:37:24 +0000

Houston, We've Got a Problem!

  • I have successfully programmed the Bootloader for 360F512L

  • With one FTDI232 USB-to-serial module, i can upload the Sketch. All right!

Well, i built a complex circuit with one MX360 and one TFT Display (with SSD1963 chip), i used UTFT Library for Arduino based-board, version for chipKit (3 versions: ARM, AVR and PIC32).

I studied a lot for converting pin of original chipKIT MAX32 (with MX795) for my MX360.

The difference is for presence of USB ports on MX795 and some pin of UART Serial.

I checked more and more the wire, but my circuit don't work.

I think there is a problem with the correct assignment of the pins.

There is a table which shows the pins MX360 and the Arduino Pins?

Example: D13 = pin 56 of PIC32MX360F512L chip?

Thanks!


Ultron

Thu, 10 Oct 2013 20:47:51 +0000

Some pics...