1

I have an Arduino 328p (custom) and I can program it using a FTDI header.

However, when I power it from the FTDI using only the RAW (5V) and GND, it only executes simple programs (example blink). If in my sketch I attempt to use SPI for example, it will just get stuck.

If I power the arduino from the FTDI with the DTR pin connected, it will work just as expected for any sketch. I can even remove the DTR pin at this point and there will be no issue.

What could be the cause of this behavior?
Can it be an issue with optiboot fast start?

PS: FTDI is configured for 5V but VCC for the Arduino is 3.3V (I'm using the MCP1703 regulator). This means that the Arduino is powered by 3.3V but the RST pin will have 5V.
PPS: The Arduino is running at 16MHz

  • 1
    I didn't think arduino would run @16MHz on 3.3V – Jaromanda X Jul 7 '16 at 3:28
  • @JaromandaX Just to be sure, I switched the arduino to 8Mhz with the internal oscillator and the results are the same. Fuse settings are: -Uefuse:w:0xFD:m -Uhfuse:w:0xDC:m -Ulfuse:w:0xE2:m – smiron Jul 7 '16 at 7:52
  • If you provide a higher voltage to the reset pin, you might make it enter high-voltage-programming-mode. – Gerben Jul 7 '16 at 9:08
  • @Gerben I thought the AVRs only went into HV mode if the voltage was over 12V, I think if it worked the other way round it would cause issues. – RSM Jul 7 '16 at 13:02
0

The reason for this issue is to do with SPI.

Basically in my custom arduino I have a 4Mbit flash and it communicates over SPI. It seems that when the RST pin is connected it also automatically initializes the SPI protocol.

When the arduino is powered from RAW + GND directly from an external power source you need to initialize SPI manually.

In your sketch you need to:

    #include <SPI.h>

    void setup() {
        SPI.begin(); // this needs to be invoked before any SPI device gets initialized

        // initialize and use SPI devices
    }
  • You need to initialize the SPI before use regardless. – Chris Stratton Oct 5 '16 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.