不用回复,问题已解决
wl1111
@wl1111
wl1111 发布的帖子
-
RE: 您好,请问FR8016HA和FR8018HA能在休眠中保持蓝牙连接吗。发布在 FR801xH
@zr 这是我的相关代码static uint8_t app_power_key_is_pressed(void)
{
return ((pmu_get_gpio_port_value(GPIO_PORT_C) & APP_POWER_KEY_PC5_MASK) == 0U) ?
1U : 0U;
}static uint8_t app_power_key_wait_hold(uint32_t hold_ms)
{
uint32_t elapsed_ms = 0U;while (elapsed_ms < hold_ms) { if (app_power_key_is_pressed() == 0U) { return 0U; } co_delay_100us(100U); elapsed_ms += APP_POWER_KEY_RELEASE_POLL_MS; } return 1U;}
static void app_power_key_prepare_power_off(void)
{
while (app_power_key_is_pressed() != 0U) {
co_delay_100us(100U);
}pmu_set_pin_to_PMU(GPIO_PORT_C, APP_POWER_KEY_PC5_MASK); pmu_set_port_mux(GPIO_PORT_C, GPIO_BIT_5, PMU_PORT_MUX_GPIO); pmu_set_pin_dir(GPIO_PORT_C, APP_POWER_KEY_PC5_MASK, GPIO_DIR_IN); pmu_set_pin_pull(GPIO_PORT_C, APP_POWER_KEY_PC5_MASK, true); pmu_port_wakeup_func_set(GPIO_PC5);}
static void app_power_key_check_power_on(void)
{
if (app_power_key_is_pressed() != 0U) {
co_printf("APP: PC5 wake detected\r\n");
s_power_key_boot_pending = 1U;
}
}attribute((section("ram_code"))) void pmu_gpio_isr_ram(void)
{uint32_t gpio_value = ool_read32(PMU_REG_GPIOA_V); button_toggle_detected(gpio_value); ool_write32(PMU_REG_PORTA_LAST, gpio_value);}void user_custom_parameters(void)
{struct chip_unique_id_t id_data; efuse_get_chip_unique_id(&id_data); __jump_table.addr.addr[0] = 0xBD; __jump_table.addr.addr[1] = 0xAD; __jump_table.addr.addr[2] = 0xD0; __jump_table.addr.addr[3] = 0xF0; __jump_table.addr.addr[4] = 0x17; __jump_table.addr.addr[5] = 0xc0; id_data.unique_id[5] |= 0xc0; // random addr->static addr type:the top two bit must be 1. memcpy(__jump_table.addr.addr,id_data.unique_id,6); __jump_table.system_clk = SYSTEM_SYS_CLK_48M; __jump_table.system_option &= ~(SYSTEM_OPTION_SLEEP_ENABLE | SYSTEM_OPTION_EXT_WAKEUP_ENABLE); jump_table_set_static_keys_store_offset(JUMP_TABLE_STATIC_KEY_OFFSET); ble_set_addr_type(BLE_ADDR_TYPE_PUBLIC); retry_handshake();}void user_entry_before_ble_init(void)
{
button_reset_state();/* set system power supply in BUCK mode */ pmu_set_sys_power_mode(PMU_SYS_POW_BUCK);#ifdef FLASH_PROTECT
flash_protect_enable(1);#endif
pmu_enable_irq(PMU_ISR_BIT_ACOK | PMU_ISR_BIT_ACOFF | PMU_ISR_BIT_ONKEY_PO | PMU_ISR_BIT_OTP | PMU_ISR_BIT_LVD | PMU_ISR_BIT_BAT | PMU_ISR_BIT_ONKEY_HIGH); // Enable UART print. system_set_port_pull(GPIO_PA2, true); system_set_port_mux(GPIO_PORT_A, GPIO_BIT_2, PORTA2_FUNC_UART1_RXD); system_set_port_mux(GPIO_PORT_A, GPIO_BIT_3, PORTA3_FUNC_UART1_TXD); uart_init(UART1, BAUD_RATE_115200);#if 0
if(__jump_table.system_option & SYSTEM_OPTION_ENABLE_HCI_MODE)
{
/* use PC4 and PC5 for HCI interface */
system_set_port_pull(GPIO_PA4, true);
system_set_port_mux(GPIO_PORT_A, GPIO_BIT_4, PORTA4_FUNC_UART0_RXD);
system_set_port_mux(GPIO_PORT_A, GPIO_BIT_5, PORTA5_FUNC_UART0_TXD);
}
#endif
pmu_set_pin_to_CPU(GPIO_PORT_D, (1 << GPIO_BIT_4) | (1 << GPIO_BIT_5));
//adc_disable();system_set_port_pull(GPIO_PD4, true); system_set_port_mux(GPIO_PORT_D, GPIO_BIT_4, PORTD4_FUNC_UART0_RXD); system_set_port_mux(GPIO_PORT_D, GPIO_BIT_5, PORTD5_FUNC_UART0_TXD); uart_init(UART0, BAUD_RATE_115200); NVIC_EnableIRQ(UART0_IRQn); co_printf("PMU PORTD_SEL=0x%02X\r\n", ool_read(PMU_REG_PORTD_SEL)); app_power_key_check_power_on(); /* used for debug, reserve 3S for j-link once sleep is enabled. */ if(__jump_table.system_option & SYSTEM_OPTION_SLEEP_ENABLE) { co_delay_100us(10000); co_delay_100us(10000); co_delay_100us(10000); }}void user_entry_after_ble_init(void)
{
co_printf("BLE Peripheral\r\n");if (s_power_key_boot_pending != 0U) { if (app_power_key_wait_hold(APP_POWER_KEY_BOOT_HOLD_MS) != 0U) { co_printf("APP: PC5 held 1s, power on\r\n"); s_power_key_boot_allowed = 1U; } else { co_printf("APP: PC5 power-on hold too short\r\n"); s_power_key_boot_allowed = 0U; } s_power_key_boot_pending = 0U; } if (s_power_key_boot_allowed == 0U) { co_printf("APP: PC5 invalid wake, power off\r\n"); app_power_key_prepare_power_off(); system_power_off(false); } //播报开机 app_play_voice(5); // User task initialization, for buttons. user_task_init(); // Application layer initialization, can included bond manager init, // advertising parameters init, scanning parameter init, GATT service adding, etc. simple_peripheral_init(); NVIC_EnableIRQ(PMU_IRQn);}
-
RE: 您好,请问FR8016HA和FR8018HA能在休眠中保持蓝牙连接吗。发布在 FR801xH
@zr 您好,我这边按照论坛里的内容写下按键开关机代码后,长按关机正常,但是短按开机就会报错崩溃,请问有什么方法解决吗[11-26-00-612]收←◆Crash, dump regs:
PC = 0x010
[11-26-00-628]收←◆1A60C
LR = 0x20002739
reqchip
[11-26-00-659]收←◆freqchip
[11-26-00-706]收←◆freqchip
[11-26-00-754]收←◆freqchip
[11-26-00-785]收←◆PMU PORTD_SEL=0xBF
APP: PC5 wak
[11-26-00-800]收←◆e detected[11-26-00-848]收←◆Crash, dump regs:
PC = 0x010
[11-26-00-865]收←◆1A60C
LR = 0x20002739
freqchip
[11-26-00-895]收←◆freqchip
[11-26-00-958]收←◆freqchip
[11-26-01-005]收←◆freqchip
[11-26-01-035]收←◆PMU PORTD_SEL=0xBF
APP: PC5 wak
[11-26-01-052]收←◆e detected
我量了开发板,现在3V3管脚电压是3.27V,出现RF奔溃的原因可能是这个吗?