Microchip Fubarino mini / chipkit Mini on the Arduino IDE, configuring and accesing pins

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Analog_Fan

Well-known member
Joined
Mar 22, 2022
Messages
570
Location
Universe
// 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)
LATAbits.RA10 = 1;
delay(500); // wait for a second
//digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
LATAbits.RA10 = 0;
delay(500); // wait for a second
}

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


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

trying "old style" microchip coding on the Arduino IDE.

microchip pic32mx pins.jpeg

just as the example here:
Fubarino Mini pps

#define LED 1
#define SCK2 4
#define SDI2 18
#define SDO2 20
the example code works, somehow.
But ...
the led is connected to RA10 not pin 1,
pin 18 on the schematic is MCLR.
neither the other definitions are true.
Of course I'm more or less used to PIC18F452, PIC18F252, PIC18F1320 and some PIC16F84, where pins have "fixed" functions rather than Peripheral Pin Select (PPS).
I can't find any references or code definitions on "pinMode", how it's internally routed.
seemingly it's not quite opensource.
: )

Normally on top of your code in a pic you would configure all pins.
bank1
movlw b'00000001'
movwf TRISA

movlw b'11110000'
movwf TRISB
bank0

Arduino has: void setup()

How do i set and access all the pins on the PIC32MX250F128D to do some experiments with the onboard button?
 

Attachments

  • FubarinoMini_v15_sch.pdf
    37.2 KB
Normally on top of your code in a pic you would configure all pins.


Arduino has: void setup()

How do i set and access all the pins on the PIC32MX250F128D to do some experiments with the onboard button?
The Arduino IDE attempts to abstract that all away so it can be used by non-coders. The Arduino way is to define the function of each pin before it is used, usually in setup, where the supplied library takes care of the bare metal coding. Then in main all you do is digitalwrite, digitalread or the analogue equivalents, on the pin.

Cheers

Ian
 
Got an answer on Stack.

the info is found here.
/ackages/chipKIT/hardware/pic32/2.1.0/cores/pic32/pps/pingroups_1xx2xx.h
/packages/chipKIT/hardware/pic32/2.1.0/cores/pic32/pps/peripherals_1xx2xx.h
/packages/chipKIT/hardware/pic32/2.1.0/variants/Fubarino_Mini/Board_Data.c
it contains the pin naming ...

there are folders that start with a dot, in this case: .arduino.
they aren't visible at first sight.

haven't coded a device in like 5 years.
 
Last edited:
Setting up an Interrupt on Microchip CHPKIT (Fubarino) boards using the Arduino IDE.

volatile uint32_t counter = 0;
void __USER_ISR myISR() {
counter++;
clearIntFlag(_TIMER_3_IRQ);
}
void setup() {
// You would need to add code here to configure the timer 3
setIntVector(_TIMER_3_VECTOR, myISR);
setIntPriority(_TIMER_3_VECTOR, 4, 0);
clearIntFlag(_TIMER_3_IRQ);
setIntEnable(_TIMER_3_IRQ);
Serial.begin(9600);
}
void loop() {
delay(1000);
Serial.print("Count is now: ");
Serial.println(counter);
}

more info the in pdf from user:

majenko

Working-with-chipKIT-Interrupts.pdf
 
Last edited:
Back
Top