I'm using ATtiny404 microcontroller and programming the controller via Arduino nano using UPDI pin and jtag2updi programmer.
I'm trying to put the ATtiny404 in to sleep mode by using the below functions.
After putting in sleep mode still getting power consumption of 9mA ,Now i want to reduce the power consumption when its in sleep mode.i'm using a button interrupt for sleep wake up.
You are going to have to provide much more information so that anyone on the forum can help you. Read the forum guide, in the sticky post at the top of most forum sections, for ideas about what you need to provide.
You have to supply the entire code (or a minimal example which demonstrates the problem) .
Common problems resulting in very high current consumption in sleep mode are:
not correctly putting the device into sleep mode.
it prematurely waking before the measurement of current consumption was made.
failing to understand that entering sleep mode does not change the status of the pins, that is an output pin may continue to power something.
Actually the LDR Sensor and LED's are placed 2nd PCB and all circuitry is present in the schematic which is been shared previously. All LED's and LDR is connected to the J1 connector which is FPC connector and in the 2nd board there are only LED's and LDR are connected through one more FPC connector and both the connectors are connected via 6pin FPC cable.
Attiny is consuming 3mA at the VDD pin as the 3.3V supply is given directly to the VDD pin of the Attiny.
After disconnecting the power from the board to the Attiny only board is consuming 9mA.
OP is failing to ensure that all pins are in a defined state before going to sleep. Some people say the classics are just as bad. I think they're full of it. Floating pins trash power efficiency.
OP's programming procedure is not correctly exiting UPDI mode, disconnect from power after upload. short the (now not connected) Vdd and supply pins to discharge all the caps on the board to make sure you get a POR when you next connect power. Then connect power, and measure current.