1

I recently got a Microchip Fubarino, contains a PIC32MX250F128D and I'm totally new to the Arduino IDE, i uploaded the blink sketch all fine and well. Schematic: FubarinoMini_v15_sch

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
//pinMode(LED_BUILTIN, OUTPUT);


//asm ("BSF PORTA,10");
//pinMode(RA10, OUTPUT);
//TRISA10 = 0;
TRISAbits.RA10 = 0;
//PORTAbits.RA10 = 1;
//PORTAbits.RA10 = 0; // set to output
//mapPps(20, PPS_OUT_SDO2)
}

// the loop function runs over and over again forever
void loop() {
//digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
PORTAbits.RA10 = 1;
delay(500); // wait for a second
//digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
PORTAbits.RA10 = 0;
delay(500); // wait for a second
} 

restults in:

 Blink:45:12: error: 'volatile union __LATAbits_t' has no member named 'RA10'
LATAbits.RA10 = 0;

changing:

void loop() {
  //digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  PORTAbits.RA10 = 1;
  delay(500);                       // wait for a second
  //digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  PORTAbits.RA10 = 0;
  delay(500);                       // wait for a second
}

doesn't work either.

I also tried this example code: https://github.com/fubarino/fubarino.github.com/wiki/Fubarino-Mini-pps
It does work.

#define LED 1
#define SCK2 4
#define SDI2 18
#define SDO2 20 

The led on the Fubarino board is not connected to pin 1, but to RA10. Pin 18 is the MCLR on the device, reviewing the datasheet you can't even set SDI2 & SDO2 to the above defined numbers.

Normally on a PIC16F84 or so, you would do something like this.

bank1
movlw b'00000001'
movwf TRISA

movlw b'11110000'
movwf TRISB
bank0 

the Arduino "code" seems a bit abstract. I Would like to experiment with the button.
The Chipkit pps example shows you can use the Microchip keywords from the devices datasheet.

Can the Fubarino be setup like a classic PIC device in the Arduino IDE? Configuring all the pins before going in to loop, using the Keywords from the datasheet.

7
  • BTW, it's not a Microchip Fubarino. The Fubarino is made by Fubar Labs. Jacob would be furious if you tried claiming he was Microchip ;)
    – Majenko
    May 8, 2022 at 19:34
  • 1
    chipKIT was originally formed as a collaboration between Microchip and Digilent. Since then both have pretty much divested their interests in it and chipKIT is now a standalone entity, consisting of a number of dedicated community engineers (me, Jacob, Brian, Rick, Guy, etc), some ex-Microchip employees, some just people that love the PIC32 chips, like myself. Anyone can make a board that works with chipKIT, but to use the chipKIT name you have to have a trademark agreement with Microchip (we're trying to get control of the name from Microchip but they are dragging their heels).
    – Majenko
    May 9, 2022 at 8:40
  • 1
    The three main board makers now are myself (the chipKIT Lenny for example), Brian (Schmalzhaus boards, like the Quick240) and Jacob & Rick (Fubar Labs, the Fubarino boards). Most of the original boards (UNO32, MAX32, etc) were made by Digilent. I'm not sure if they're still making and supporting those or not. Many of the boards have been sold via Microchip's market place (who have also provided some manufacturing facilities in the past too) although they seem to have lost interest in that now.
    – Majenko
    May 9, 2022 at 8:40
  • 1
    Ever since Microchip bought Atmel they seem to have lost interest in chipKIT and focus all their attention on Atmel based Arduinos now. Even though the PIC32 is by far a vastly superior chip and the chipKIT framework boasts a much better codebase than Arduino ;) The main problem we are facing at the moment though is that of a compiler - Microchip have traditionally provided us with an open source version of their XC32++ compiler, but since OS X went 64-bit only they have really struggled with producing a new version for us.
    – Majenko
    May 9, 2022 at 8:43
  • 1
    I'm in the process (slowly) of adapting vanilla mips-gcc to work properly with chipKIT but it's a long hard job. The compiler part is fine, it's the low-level chip support libraries that are not simple, especially for the more complex PIC32MZ chips.
    – Majenko
    May 9, 2022 at 8:43

1 Answer 1

1

The entries in the "bits" structures are named after the bits.

It's not

TRISAbits.RA10

but

TRISAbits.TRISA10

The same goes for

LATAbits.LATA10

The only exception is the "port" one

PORTAbits.RA10

Which is a hangover from the old PIC16 chips that didn't have a LATx register.


The led on the Fubarino board is not connected to pin 1, but to RA10.

Pin 1 is RA10. If you look in the file Board_Data.c for the Fubarino_Mini variant (packages/chipKIT/hardware/pic32/2.1.0/variants/Fubarino_Mini/Board_Data.c) you can see all the pin mappings. There's a bunch of arrays there that define how everything fits together.

The second entry in most of those arrays (pin 1, starts counting at 0) is for RA10. As for

Pin 18 is the MCLR on the device, reviewing the datasheet you can't even set SDI2 & SDO2 to the above defined numbers.

the PPS is a whole other mess on those chips. Pin 18 is not the 18th pin on the board, but digital IO pin number 18, which is the 19th entry in those pin array tables - RA4. Mapping RA4 is done through the file packages/chipKIT/hardware/pic32/2.1.0/cores/pic32/pps/pingroups_1xx2xx.h which contains an entry:

#define _PPS_RPA4       (2 + _PPS_SET_C)

and the file packages/chipKIT/hardware/pic32/2.1.0/cores/pic32/pps/peripherals_1xx2xx.h which has:

PPS_IN_SDI2     = (35 + _PPS_SET_C + _PPS_INPUT_BIT),

Those are then used by the mapPps() function to map RA4 to SDI2. Something which is perfectly possible.

Yes, it's convoluted and a bit of a mess, but the best we could come up with given how limited the PIC32MX2xx IO multiplexer is.

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Majenko
    May 9, 2022 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.