AVR resets when bluetooth SPI device is powered on

I am using an Atmega328p. My project is using an Adafruit Bluefruit LE SPI Friend (Adafruit Bluefruit LE SPI Friend - Bluetooth Low Energy (BLE) : ID 2633 : $17.50 : Adafruit Industries, Unique & fun DIY electronics and kits) to send data wirelessly. I plan to switch the BLE module with a mosfet so that the power is cut when it is not sending data.

I have encountered a problem that when I am running any program on my AVR, connecting power to the BLE module sends the AVR into reset.

I am running a simple/blank program that just outputs to serial when the device has been reset.

Does anyone know why this is happening? Thanks :slight_smile:

Wiring problem.

For informed help, please read and follow the instructions in the "How to use this forum" post, at the top of every forum topic.

I have simplified the circuit, to a standalone atmega328p, 10k pullup resistor on reset pin, 8mhz external clock. Now if I power up the BLE module sharing the same vcc as the atmega328p (with all SPI wires unconnected between BLE module and atmega328p), the AVR resets. I have tried a range of bypass capacitors across vcc and gnd on the AVR.

It seems to be the initial power surge of the BLE module which causes the atmega to reset.

I have tried disabling BOD on the microcontroller but did not solve the issue. I have also measured the voltage of the reset pin with a scope and it stays pulled high during the reset.

What is the power source? You may be drawing too much current, which causes the AVR to reset.

Re: "A range of bypass capacitors":

You should have a 100nF (0.1uF) cap across the power pins as close as possible. At all times. Don't try "a range". The purpose of the small value is to shunt high frequency noise to ground.

To possibly deal with surge current you could try a large-ish (100uF - 470uF) cap at the power supply.

The two capacitors serve different purposes. But you really need a power supply that can handle what you're expecting of it.