PIC32MX270F256B Support?

Let us know what you think about the chipKIT, and what can be done to make it better!
Marevealous
Posts: 17
Joined: Tue Jul 19, 2016 10:41 am

Re: PIC32MX270F256B Support?

Post by Marevealous » Tue Aug 02, 2016 1:53 pm

majenko wrote: I have a pull request pending with the correct linker script and other associated code for use on an MX270 (I am developing a new chipKIT board that is MX270 based - to be released on the masses shortly).
Hey, what is the state of PIC32MX270F256B support?
Does it have a working USB bootloader for chipkit? Which hex file is that? (Again, the names are confusing, why not name bootloaders with prefix of chip name)..

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: PIC32MX270F256B Support?

Post by majenko » Tue Aug 02, 2016 4:23 pm

MX270 is fully supported. The Lenny board uses the MX270F256D chip and is part of the standard repertoire of chipKIT now.

There is no active board with the B version though so there is no pre-built bootloader for that chip. Only the D version for the Lenny. A B version can be built easily enough though should it be required - if you provide the pin definitions for it of course.

The reason the bootloaders are named after the boards and not the chips is because the bootloader is specific to the board. You can have multiple boards that use the same chip yet require their own distinct bootloaders because the IO pin definitions and config bits are different.

All the major boards are listed in the wiki (http://chipkit.net/wiki/index.php?title=Boards) with the chips they use. Find a board that uses the same chip you want to use and replicate the relevant parts. That way you can use the same bootloader as that board.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Marevealous
Posts: 17
Joined: Tue Jul 19, 2016 10:41 am

Re: PIC32MX270F256B Support?

Post by Marevealous » Tue Aug 02, 2016 8:01 pm

majenko wrote:Only the D version for the Lenny. A B version can be built easily enough though should it be required - if you provide the pin definitions for it of course.
Well...
http://wiki.pinguino.cc/images/7/75/Pin ... e_2013.png
That's the PCB I have.
I will program PIC32MX270F256B with pic32 prog (already tested and working) and put that chip there (socket).
So the pin definitions are:
LED PIN: 2
BOOTLOADER button (on press it's connected to ground): 3
Is this what you meant? Thanks in advance.

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: PIC32MX270F256B Support?

Post by majenko » Tue Aug 02, 2016 8:54 pm

Yep, that's just what I meant. Here's a bootloader compiled with those pins and that chip / crystal combination.
Attachments
Olimex_PIC32_Pinguino_DIY.zip
(6.34 KiB) Downloaded 36 times
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Marevealous
Posts: 17
Joined: Tue Jul 19, 2016 10:41 am

Re: PIC32MX270F256B Support?

Post by Marevealous » Wed Aug 03, 2016 1:06 am

That's great! LED blinks happily and PC detects some STK500v2 device, but... what now ?

Well, I will try to follow http://chipkit.net/diy-chipkit-board/, but what board should I select?

UPDATE:
I have manuall installed the chipkit core libraries for Arduino IDE (the downloaded from within IDE stuck at 0kb),
and now I separately downloaded the USBDriverInstaller.exe and installed the USB drivers.
So now the question is which board should I choose?
Now I have a virtual chipkit serial in my Devices Mangager.

UPDATE2: I've chosen Lenny board, is that correct? I have now:

Code: Select all

Programmer for Microchip PIC32 microcontrollers, Version 2.0.220
    Copyright: (C) 2011-2015 Serge Vakulenko
      Adapter: STK500v2 Bootloader
 Program area: 1d000000-1d1fffff
    Processor: Bootloader
 Flash memory: 2048 kbytes
  Boot memory: 80 kbytes
         Data: 6228 bytes
        Erase: done
Program flash: ........######### done
 Verify flash: ........######## done
 Program rate: 36635 bytes per second
 
but I don't even know which PIN number has my LED which I'd like to blink...

UPDATE:
I've managed to receive something in realterm from CDC. Code:

Code: Select all


// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // print out the state of the button:
  Serial.println("Hello");
  delay(1);        // delay in between reads for stability
}
Questions:
1. which pin number here is my LED?
2. How to know which pin has which number?
3. Why can't I view CDC messages in Arduino terminal?
4. IDE says that there is 128 KB memory and not 256...
5. Sometimes I am getting random errors (with random file names) like:

Code: Select all

Arduino\hardware\chipkit-core\pic32\cores\pic32\pins_arduino.c:86:0: fatal error: opening dependency file core\pins_arduino.c.d: No such file or directory
What's wrong?
6. It seems that the Arduino IDE with chipkit stuff does not check for the board compatitiblity, I mean, I tried both "Lenny board" and "Pinguino board" selection and in both cases it downloaded the code!
7. Huh, I have managed to blink a LED, but, oh, well, see yourself:

Code: Select all

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  for(int i = 0; i < 25; i++)
  {
    pinMode(i, OUTPUT);
  }
}

// the loop function runs over and over again forever
void loop() {
  for(int i = 0; i < 25; i++)
      digitalWrite(i, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  for(int i = 0; i < 25; i++)
      digitalWrite(i, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}
It indeed works, and I'm pretty happy because pinMode and digitalWrite functions are able to take a variable as pin index.

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: PIC32MX270F256B Support?

Post by majenko » Wed Aug 03, 2016 11:06 am

You require a specific board configuration that matches your circuit. Not only must the chips match (at least broadly), but the IO pin definitions must be configured right.

Without that things like `digitalWrite()` etc won't know where to route the commands.

Selecting a similar board may kind of work, but the IO pin numbers won't even remotely resemble your board.

Without a board configuration the closest you can really do is pick one with the same base chip and manually control the chip using the low-level registers, like TRISA, PORTA, LATA, etc.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Marevealous
Posts: 17
Joined: Tue Jul 19, 2016 10:41 am

Re: PIC32MX270F256B Support?

Post by Marevealous » Wed Aug 03, 2016 11:31 am

Which files do I edit? Only boards.txt?

Btw, is this just purely inlogical, or did I find a bug:

Code: Select all

# 128KB - 4K for EEPROM - 4K for bootloader
lenny.upload.maximum_size=122880
lenny.upload.speed=115200
lenny.upload.tool=pic32prog

( ... )

lenny.build.mcu=32MX270F256D
lenny.build.f_cpu=40000000L
lenny.build.core=pic32
lenny.build.variant=Lenny
32MX270F256D has 128KB?
The wiki says that Lenny has 256KB: http://chipkit.net/wiki/index.php?title=ChipKIT_Lenny
PS: I have used chipkit-core-windows.16778040.master-v1.2.0-4-g3088e62.zip pack.

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: PIC32MX270F256B Support?

Post by majenko » Wed Aug 03, 2016 12:33 pm

Yes, that is a mistake. It shouldn't affect anything though, it's just for reporting of sketch size %.

It's the Board_Data.c and Board_Defs.h files that define how the board is layed out.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Marevealous
Posts: 17
Joined: Tue Jul 19, 2016 10:41 am

Re: PIC32MX270F256B Support?

Post by Marevealous » Wed Aug 03, 2016 1:30 pm

So now, if I want to use Serial0 and Serial1 (because Serial is just USB virtual com port) on my board, and also I2C and SPI (assuming that it's supported), I need to change those files?

Those are .c files, do I need to recompile and reburn bootloader as well?
*/
#define _SER1_BASE _UART1_BASE_ADDRESS
#define _SER1_IRQ _UART1_ERR_IRQ
#define _SER1_VECTOR _UART_1_VECTOR
#define _SER1_IPL_ISR _UART1_IPL_ISR
#define _SER1_IPL _UART1_IPL_IPC
#define _SER1_SPL _UART1_SPL_IPC
#define _SER1_TX_OUT PPS_OUT_U1TX
#define _SER1_TX_PIN 2
#define _SER1_RX_IN PPS_IN_U1RX
#define _SER1_RX_PIN 4
I understand what is TX_OUT and RX_IN, because it's using PPS system just like the PIC32 in mikroC and I used that before. But what is 2 and 4 here? Is 2 and 4 here just for the Arduino, or is this some value from PIC datasheet?

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: PIC32MX270F256B Support?

Post by majenko » Wed Aug 03, 2016 1:32 pm

2 and 4 refer to entries in the pin definition tables in Board_Data.c. Those are the main ones that you need to edit to suit your board arrangement.

And no, you don't need to reburn the bootloader. These files are compiled as part of your sketch and uploaded from the IDE.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply