Page 1 of 1

VS1010D Memorize the setting value

Posted: Thu 2022-01-20 12:24
by Hiro
If you add the following processing and start it again with PWRBTN, the setting value will be initialized.
Is it possible to remember the settings such as volume?
printf("ECO Mode ON\n");
Disable(); /* No more interupts */
SetPLL(1); /* 1X clock */
/* Enable bits down */
PERIP(ANA_CF0) = 0;
PERIP(ANA_CF1) = 0;
PERIP(ANA_CF2) = 0;
PERIP(ANA_CF3) = 0;
/* Drive GPIO pins down */
PERIP(GPIO0_ODATA) = 0;
PERIP(GPIO1_ODATA) = 0;
PERIP(GPIO2_ODATA) = 0;
/* Shutdown regulators */
PERIP(REGU_CF) = 0;
PERIP(REGU_CF) = REGU_CF_AOFF | REGU_CF_IOOFF | REGU_CF_COFF;
PERIP(REGU_CF) |= REGU_CF_REGCK;
PERIP(REGU_CF) &= ~REGU_CF_REGCK;
DelayL(100000);

Re: VS1010D Memorize the setting value

Posted: Thu 2022-01-20 12:40
by pasi
Turning off the regulators will cause the voltages to drop and there is no supply to keep the register or memory state. In addition, during the next power-up, a reset is generated to make sure the registers start in consistent state. (Memory is also in powerdown while reset is active.)

You need external volatile storage (SPI EEPROM of FLASH) or provide RTC power to vs1010 from a battery and store your information in the RTC. There is limited number of bits available in the RTC, but enough to store volume and current song number.

Re: VS1010D Memorize the setting value

Posted: Thu 2022-01-20 13:53
by Hannu
This will shutdown better:

Code: Select all

	// Regulators off
	PERIP(REGU_CF) = 0;
	PERIP(REGU_CF) = (1 << 4) | REGU_CF_AOFF | REGU_CF_IOOFF | REGU_CF_COFF;
	PERIP(REGU_CF) |=  REGU_CF_REGCK;    /* clk up */
	PERIP(REGU_CF) &= ~REGU_CF_REGCK;    /* clk down */
	DelayL(100000); // Power will finally die during this loop.
And the RTC has 32-bits available.
If more state is needed to store to SPI flash: viewtopic.php?f=15&t=2758

Re: VS1010D Memorize the setting value

Posted: Mon 2022-01-31 7:30
by Hiro
Dear Hannu.

I tried to change the regulator that I was told, but the situation did not change.
The setting value will be initialized.

Re: VS1010D Memorize the setting value

Posted: Mon 2022-01-31 8:56
by Hannu
Indeed the system will initialize all memory except the 32 bits in RTC. You need external non-volatile memory to save your data if it doesn't fit to 32 bits.

My point for shutdown was the (1 << 4) which causes current consumption to go to zero, not to just about 1 mA