完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
下午好,我现在按照官方的pulse_count_event历程,注册中断失败
x1b[0;31mE (15294) pcnt: pcnt isr registration failed, maybe you need `pcnt_isr_unregister` to unregister your isr x1b[0m x1b[0;31mE (15294) pcnt: _pcnt_isr_handler_add(252): ISR service is not installed, call pcnt_install_isr_service() first x1b[0m x1b[0;31mE (15304) pcnt: pcnt isr registration failed, maybe you need `pcnt_isr_unregister` to unregister your isr x1b[0m x1b[0;31mE (15314) pcnt: _pcnt_isr_handler_add(252): ISR service is not installed, call pcnt_install_isr_service() first x1b[0m 下面源代码,麻烦给看下,谢谢 static void pcnt_example_init(int unit,int channel, int pin) { /* Prepare configuration for the PCNT unit */ pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs .pulse_gpio_num = pin,//PCNT_INPUT_SIG_IO0 //.ctrl_gpio_num = PCNT_INPUT_CTRL_IO, .channel = channel,//PCNT_CHANNEL_0, .unit = unit, // What to do on the positive / negative edge of pulse input? .pos_mode = PCNT_COUNT_INC, // Count up on the positive edge .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge // What to do when control input is low or high? .lctrl_mode = PCNT_MODE_KEEP, // Reverse counting direction if low .hctrl_mode = PCNT_MODE_KEEP, // Keep the primary counter mode if high // Set the maximum and minimum limit values to watch .counter_h_lim = 5, .counter_l_lim = 0, }; /* Initialize PCNT unit */ pcnt_unit_config(&pcnt_config); /* Configure and enable the input filter */ pcnt_set_filter_value(unit, 100);//100 pcnt_filter_enable(unit); /* Set threshold 0 and 1 values and enable events to watch */ // pcnt_set_event_value(unit, PCNT_EVT_THRES_1, PCNT_THRESH1_VAL); // pcnt_event_enable(unit, PCNT_EVT_THRES_1); // pcnt_set_event_value(unit, PCNT_EVT_THRES_0, PCNT_THRESH0_VAL); // pcnt_event_enable(unit, PCNT_EVT_THRES_0); /* Enable events on zero, maximum and minimum limit values */ pcnt_event_enable(unit, PCNT_EVT_ZERO); pcnt_event_enable(unit, PCNT_EVT_H_LIM); // pcnt_event_enable(unit, PCNT_EVT_L_LIM); /* Initialize PCNT's counter */ pcnt_counter_pause(unit); pcnt_counter_clear(unit); /* Install interrupt service and add isr callback handler */ pcnt_isr_service_install(0); pcnt_isr_handler_add(unit, pcnt_example_intr_handler, (void *)unit); // pcnt_isr_register(pcnt_example_intr_handler, NULL, 0, &user_isr_handle); // pcnt_intr_enable(unit); /* Everything is set up, now go to counting */ pcnt_counter_resume(unit); } |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
313浏览 6评论
270浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
259浏览 5评论
265浏览 4评论
241浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-6-26 21:45 , Processed in 0.952239 second(s), Total 75, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191