Using Adafruit_MCP3008.h library causes pin 13 LED to light up

Status
Not open for further replies.
Hi there,
I'm using a Teensy 4.1 connected to an MCP3008 via SPI where pin 13 is the SCK.
I'm using the Adafruit_MCP3008.h library to interface with the ADC, however I'm getting a weird problem on some of my boards but not others: when I start the SPI with adc.begin(), the LED attached to pin 13 on my Teensy will light up. This is occurring on 3 out of 5 of my boards. The ADC seems to be functioning just fine and I am getting readings with adc.readADC(). However I don't want the LED to light up because it will drain the battery.
If I reflash with Blink firmware then the LED flashes normally.
Does anyone have any idea what might be causing this?
Thanks.
 
You haven't posted your code.

Can you confirm the boards are identical, programmed identically? Normally the quiescent SCLK will be determined by the
SPI mode in use.

Are you expecting the tiny LED on the pcb to consume significant power compared to the rest of the T4.1?
 
Thanks Mark,

The code is over 500 lines and proprietary, but I have found that commenting out the adc.begin() stops the LED turning on. I can also turn the light off by manually setting pin 13 LOW (which breaks SPI, obviously).

From this standpoint, I'm just wondering is it normal for the SCK signal to light up the LED? And if so, why is it happening on some of my boards and not others?

This thread seems to indicate that it is normal, with the SCK behaving somewhat like a PWM.

The boards are identical copies from the same PCBway run, each with its own Teensy soldered on, programmed identically. The LED will consume some power and it's a battery powered application, so I would prefer it off. But far more importantly, I just really need to understand what's going on here. Is this normal?
 
If the boards are identical and programmed identically I would expect the LEDs to light identically.
Yes the pin drives the LED so it will light up when there's activity. LEDs light up in nanoseconds, no
problem following a logic signal. Its possible different LEDs might have different turn-off delays
perhaps that explains a difference in brightness?

You know the Teensy 4 pulls a lot of current, will dwarf the LED few mA I suspect.
 
Thanks all. Looks like this is normal behaviour

This is due to the Teensy using the same pins for Arduino UNO, which had the SPI clock pin (13) on the same pin as the LED. The first Serial port (pins 0/1) and the I2C bus (18/A4 and 19/A5) are also the same. Having the clock pin be the same as the LED, doesn't interfere with SPI transfers, but it does cause the LED to blink rapidly.
 
Status
Not open for further replies.
Back
Top