I’m working on porting my FastLED library to the SparkCore platform, working on the fast pin i/o at the moment. I have a simple test program to just toggle the value of pin 13 (PA5) and it appears that my loop function isn’t ever getting called. I have an application that looks like this:
#include<FastLED.h>
using namespace FastLED;
void setup() { FastPin<13>::setOutput(); }
void loop() { FastPin<13>::hi(); delay(500); FastPin<13>::lo(); delay(1000); }
I’ve verified that this is compiling correctly - looking at the asm of the elf file:
08005a2c <loop>:
8005a2c: b538 push {r3, r4, r5, lr}
8005a2e: 4c07 ldr r4, [pc, #28] ; (8005a4c <loop+0x20>)
8005a30: 2520 movs r5, #32
8005a32: 6125 str r5, [r4, #16]
8005a34: f44f 70fa mov.w r0, #500 ; 0x1f4
8005a38: f000 ff30 bl 800689c <delay>
8005a3c: 6165 str r5, [r4, #20]
8005a3e: f44f 707a mov.w r0, #1000 ; 0x3e8
8005a42: e8bd 4038 ldmia.w sp!, {r3, r4, r5, lr}
8005a46: f000 bf29 b.w 800689c <delay>
8005a4a: bf00 nop
8005a4c: 40010800 andmi r0, r1, r0, lsl #16
Right now, FastPin::setOutput is just a call to pinMode, which looking at the disasm for setup() is getting called. And I’m flipping the bit for pin 13, 40010800 is the base address for GPIOA, the offset of #16 is BSRR and #20 is BRR, and I’m setting the 6th bit on BSRR, which should be raising the pin high, and then setting the 6th bit of BRR which should be raising the pin low. However, I’m not seeing pin13 toggling on my logic probe.
Also, if I change my loop function to call digitalWrite directly instead of my own code:
void loop() { digitalWrite(13,1); delay(500); digitalWrite(13,0); delay(1000); }
I’m also still not seeing the toggle in the logic probe.
I’m building the firmware from the command line, and I’m definitely flashing the built .bin file and the asm dumps above come from the .elf file alongside the .bin file that gets flashed.