Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to wake up the chip in tickless #33

Open
Orionxer opened this issue Jan 4, 2023 · 1 comment
Open

Failed to wake up the chip in tickless #33

Orionxer opened this issue Jan 4, 2023 · 1 comment

Comments

@Orionxer
Copy link

Orionxer commented Jan 4, 2023

I tried to make the chip enter sleep mode and wake up, the chip could enter sleep mode but failed to wake up.

Here is the code of main.c, actually I copied this code from official example to my KM4_project. The example path is ambd_sdk/project/realtek_amebaD_va0_example/example_sources/PMC/raw/pm_tickless/src/main.c

#include "ameba_soc.h"
#include "main.h"

#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
extern VOID wlan_network(VOID);
#endif

static u32 app_loguart_suspend(u32 expected_idle_time, void *param)
{
	// For peripherals that need turned off before sleep, call disable or deinit peripheral here
	DiagPrintf("app_loguart_suspend\n");

	return TRUE;
}

static u32 app_loguart_resume(u32 expected_idle_time, void *param)
{
	// For peripherals that are turned off before sleep, call enable or init peripheral here
	DiagPrintf("app_loguart_resume\n");
	/*set km4 active time*/
	pmu_set_sysactive_time(5000);
	return TRUE;
}

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
	/* init console */
	shell_recv_all_data_onetime = 1;

	InterruptRegister(IPC_INTHandler, IPC_IRQ, (u32)IPCM0_DEV, 10);
	InterruptEn(IPC_IRQ, 10);

	shell_init_rom(0, 0);	
	shell_init_ram();
	ipc_table_init();

	/* Register Log Uart Callback function */
	InterruptRegister((IRQ_FUN) shell_uart_irq_rom, UART_LOG_IRQ, (u32)NULL, 10);
	InterruptEn(UART_LOG_IRQ,10);

#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
	rtw_efuse_boot_write();

	wlan_network();
#endif
	/*set KM4 sleep type*/
	pmu_set_sleep_type(SLEEP_PG);
	/*acquire wakelock to avoid KM4 enter sleep mode*/
	pmu_acquire_wakelock(PMU_OS);
	
	pmu_register_sleep_callback(PMU_LOGUART_DEVICE, (PSM_HOOK_FUN)app_loguart_suspend, NULL, (PSM_HOOK_FUN)app_loguart_resume, NULL);

	/*release wakelock to allow KM4 enter sleep mode*/
	pmu_release_wakelock(PMU_OS);
	/* Enable Schedule, Start Kernel */
	vTaskStartScheduler();
}

The LOG_UART printed app_loguart_suspend which means the chip entered the sleep mode, but when I sent ENTER, the LOG_UART sent ENTER back without waking up the chip.
image

How could I wake up the chip?

@S10143806H
Copy link
Contributor

Hi @Orionxer,
I will verify this issue and get back to you soon.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants