TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: Bullwinkle on December 13, 2016, 03:20:25 PM

Title: (Nordic) BLESetup call causes digitalWrite(LED_BUILTIN, HIGH) to stop working
Post by: Bullwinkle on December 13, 2016, 03:20:25 PM
I've been using the "TinyShield_NRF8001_BLE_Example" project as a starting point for a new project.
I've added "assert" code with serial port output to verify that LED_BUILTIN is in fact pin13 in my build.
I've also put pinMode(LED_BUILTIN, OUTPUT) in my Setup method.   If I replace my "loop" method with
the simple "blink led" using digitalWrite and delays, it works fine UNLESS I make a call to BLEsetup() in
my Setup() method!   I have looked at UART.h (which is where BLEsetup is apparently defined) and I don't
see any "pin" definitions or anything that would seem to conflict with pin 13 being used for the processor
board's LED.
 A side note: looking at what appears to be the Tiny's processor board schematic on that page's link, "SCK"
is marked as the driver of the LED; "SCK" on the chip is pin 17.   Since I *know* that pin 13 works correctly
(per the "assert(LED_BUILTIN == 13)" not failing in my code), I can only conclude the schematic may be wrong.
   Anyone have thoughts on this one?
Thanks very much!
Jim
Title: Re: (Nordic) BLESetup call causes digitalWrite(LED_BUILTIN, HIGH) to stop working
Post by: Ben Rose on December 22, 2016, 04:49:38 PM
Sorry about the slow response. 'SCK' is the SPI clock pin, which is Arduino pin 13 and used with the Nordic TinyShield. The processor pin numbering is separate and abstracted from in the Arduino environment. Unfortunately the 'pin 13 LED' thing is one of those Arduino quirks that we're more or less stuck with on the ATmega328p based boards for compatibility, so the built in LED cannot be used normally when SPI is used.