Help find a bug!
Issue:
Cannot toggle pin PB27 when “Macchina M2” board is selected.
Background:
The Single-Wire CAN transceiver (TH8056) found on the M2 interface board has 2 mode pins (M0 and M1) that select between Sleep, High-Speed, High-Voltage Wake-Up and Normal Mode. Here is the SWCAN library.
We’ve got M0 connected to pin PB27 on the SAM3x8E processor (signal is named SWC_M0 on schematic). For some reason, this pin will not toggle when “Macchina M2” board is selected. A quick test sketch toggling the mapped pin name SWC_M0, doesn’t work:
void setup() {
pinMode(SWC_M0, OUTPUT);
}
void loop() {
digitalWrite(SWC_M0, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(SWC_M0, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
BUT toggling pin 13 (also PB27) with “Arduino DUE (Native USB Port)” board selected like this work!
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
So there is a bug somewhere here maybe? It sure does look similar to the Arduino Due board files here.
For easy probing, here is a diagram showing where to find M0 and M1 on the processor board. You should see 0 or 3.3V levels.
Bounty:
Besides the satisfaction of knowing you are helping to move the car-hacking community forward, we’ll send you a copy of The Car Hacker’s handbook.
Do a pull request in Github or reply to this post with what you figure out!
Thanks!
Team Macchina