1个月前
app_easy_timer不适用于user_app_on_init
张贴了gustavo.laureano.65分 5回复你好,
我跟着本指南:
http://lpccs-docs.dialog-seminiondiond.com/tutorial_sdk6 / add_data.html.
to make the advertising data dynamic, but for some reason the timer is not started when called from user_app_on_init, but works when called from another place (like on_disconnect)
在App_On_Init中调用的函数(用断点检查),它不会落入“returneyal_timer_invalid_invalid_timer”(也使用断点检查)
Any ideas why would the timer not start from init?
Thanks
Best Regards
古斯塔沃
1个月前
Hi PM_Dialog
Thanks, It works when I start from the adv_start user callback, the only change I made was to always cancel any previous timer, otherwise it was generating multiple timer instances running in parallel:
void user_app_adv_start(void){app_easy_timer_cancel(app_add_data_update_timer_used);app_add_data_update_timer_used = app_easy_timer(app_add_data_update_to,avd_data_update_timer_cb);//一秒钟单拍计时器app_easy_gap_undircted_advertise_start();}
但是你有什么想法为什么无法从App_init回调开始定时器?
I searched the documentation and there is no explicit reason why it would not work..
And another (unrelated) question:
在DA14531上使用UART ROM代码(使用#undef CFG_UART1_SDK)时,我遇到了问题,它永远不会调用注册的回调,并且只有在我设置使用SDK UART实现时(#define cfg_uart1_sdk),但我找不到任何信息,说明为什么ROM代码无法正常工作,这是ROM代码上的错误吗?或者我需要在处理中断时始终使用编译的驱动程序?
Thanks!
古斯塔沃
1个月前
以下是相关零件:
user_periph_setup.c上的外设初始化
静态常量uart_cfg_t uart_cfg = {.baud_rate =UART_BAUDRATE_115200, .data_bits = UART_DATABITS_8, .parity = UART_PARITY_NONE, .stop_bits = UART_STOPBITS_1, .auto_flow_control = UART_AFCE_DIS, .use_fifo = UART_FIFO_DIS, .tx_fifo_tr_lvl = UART_TX_FIFO_LEVEL_0, .rx_fifo_tr_lvl = UART_RX_FIFO_LEVEL_0, .intr_priority = 2, }; void periph_init(void) { // In Boost mode enable the DCDC converter to supply VBAT_HIGH for the used GPIOs syscntl_dcdc_turn_on_in_boost(SYSCNTL_DCDC_LEVEL_3V0); // ROM patch patch_func(); // Initialize peripherals uart_initialize(UART1, &uart_cfg); GPIO_ConfigurePin(UARTx_TX_GPIO_PORT, UARTx_TX_GPIO_PIN, OUTPUT, PID_UART1_TX, false); GPIO_ConfigurePin(UARTx_RX_GPIO_PORT, UARTx_RX_GPIO_PIN, INPUT, PID_UART1_RX, false); // Enable the pads GPIO_set_pad_latch_en(true); }
我的user.c上的代码:
静态void UART_READ_CB(UINT16_T长度){//将接收的字节推入环形缓冲区ringbuffer_add(ringbuffer_inst_rx,&rxbuf_cb);//启动下一个异步读取1个字符。UART_RECEIVE(UART1,&RXBUF_CB,1,UART_OP_INTR);} void user_app_on_init(void){ringbuffer_init(ringbuffer_inst_rx,ringbufer_buffer_rx,sizeof(uint8_t),64);UART_REGISTER_RX_CB(UART1,UART_READ_CB);UART_RECEIVE(UART1,&RXBUF_CB,1,UART_OP_INTR);/ *启动UART接收* / default_app_on_init();}
发送数据(通过阻塞模式下的UART_SEND)始终有效,但是在i #define cfg_uart1_sdk时,使用中断接收数据,否则从未调用UART_READ_CB
1个月前
嗨gustavo,
谢谢你的问题。我建议在user_app_on_init()之后设置计时器。请尝试以下更改:
在user_config.h:
在user_callback_config.h:
在user_empty_peripherala_template.h:
在user_empty_peripheral_template.c:
谢谢,PM_DIALOG.