Quadrature Decoder - select appropriate type

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
adam.stroz
Offline
最后一次见到:19 hours 44 min ago
Joined:2020-05-22 07:54
Quadrature Decoder - select appropriate type

Hello,

我有一个关于使用DA14531旋转编码器的小问题。

How to choose the right type of encoder?

需要注意哪些参数?

Whether this encoder will work with the built-in decoder (pdf in attachment)? I wrote a simple program and it counts impulses wrong (e.g. 12 24 36)

Sample code here:

void quad_decoder_user_callback_function(int16_t qdec_xcnt_reg, int16_t qdec_ycnt_reg, int16_t qdec_zcnt_reg) { arch_printf( "\n\r DX: "); arch_printf( "%i %i\n\r",qdec_xcnt_reg >> 8,qdec_xcnt_reg & 0xFF); quad_decoder_enable_irq(1); } void quad_decoder_init_enc(void){ QUAD_DEC_INIT_PARAMS_t quad_dec_init_param = {.chx_port_sel = QUAD_DEC_CHXA_P08_AND_CHXB_P09, .chy_port_sel = QUAD_DEC_CHYA_NONE_AND_CHYB_NONE, .chz_port_sel = QUAD_DEC_CHZA_NONE_AND_CHZB_NONE, .qdec_clockdiv = 0, .qdec_events_count_to_trigger_interrupt = 1,}; quad_decoder_init(&quad_dec_init_param); quad_decoder_register_callback(quad_decoder_user_callback_function); quad_decoder_enable_irq(1); }

Attachment:
Device:
PM\U对话框
Offline
最后一次见到:17 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi adam.stroz,

Hi adam.stroz,

Please check the DA14531 datasheet Table 3: Absolute Maximum Ratings and Table 4: Recommended Operating Conditions. Given that the encoder can be connected to any of the DA4531 pins, you should check that the output of the input channels are according to DA14531 pin specifications.

I would recommend first checking theUM-B-119: DA14585-DA14531 SW Platform Referenceand section 5.10. Quadrature Decoder Example. Are you able to run the SDK example? Take a look at Table 15 HDK jumper configuration Quadrature decoder.

谢谢,下午好

adam.stroz
Offline
最后一次见到:19 hours 44 min ago
Joined:2020-05-22 07:54
Hello,

Hello,

是的我跑这个例子,它还显示坏的价值es. I run the program on my custom PCB, here are sample readings (the message is sent after turning the encoder by 4 steps, not one as it should be)

DX: 0 4 DX: 0 18 DX: 0 28 DX: 0 37 DX: 0 50 DX: 0 52 DX: 0 70

PM\U对话框
Offline
最后一次见到:17 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi adam.stroz,

Hi adam.stroz,

Can you please indicate the pinout that you are using? Is it P06 (CHX_A) and P05 (CHX_B)? Did you try to run it in our DK to check if there is any difference?

谢谢,下午好

adam.stroz
Offline
最后一次见到:19 hours 44 min ago
Joined:2020-05-22 07:54
Currently i'm using this

Currently i'm using this pinout:

#define ENCODER_SW_PORT GPIO_PORT 0#define ENCODER_A_PIN GPIO_PIN 9#define ENCODER_B_PIN GPIO_PIN 8/////////////////////GPIO_ConfigurePin(ENCODER_SW_PORT,ENCODER_A_PIN,INPUT_PULLUP,PID_GPIO,true);GPIO_ConfigurePin(ENCODER_SW_PORT,ENCODER_B_PIN,INPUT_PULLUP,PID_GPIO,true);///////////////////////////////四边形\u DEC \u CHXA \u P08 \u和\u CHXB \u P09

您所说的“您是否尝试在我们的DK中运行它以检查是否有任何差异”是什么意思

Diagram in attachment.

Attachment:
PM\U对话框
Offline
最后一次见到:17 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi adam.stroz,

Hi adam.stroz,

Sorry for the confusion – I meant to put the encoder on the Pro-DK and test it. I assume that you have a custom board.

Can you please use a clean quadrature_decoder project as provided by the SDK and do only the following modifications? The P08 is used for the UART2.

Project location : 6.0.14.1114\projects\target_apps\peripheral_examples\quadrature_decoder\Keil_5

In user_periph_setup.h :

#define UART2_TX_PORT GPIO_PORT_0 #define UART2_TX_PIN GPIO_PIN_5 #define QUADRATURE_ENCODER_CHX_A_PORT GPIO_PORT_0 #define QUADRATURE_ENCODER_CHX_A_PIN GPIO_PIN_8 #define QUADRATURE_ENCODER_CHX_B_PORT GPIO_PORT_0 #define QUADRATURE_ENCODER_CHX_B_PIN GPIO_PIN_9 #define QUADRATURE_ENCODER_CHX_CONFIGURATION QUAD_DEC_CHXA_P08_AND_CHXB_P09

谢谢,下午好

adam.stroz
Offline
最后一次见到:19 hours 44 min ago
Joined:2020-05-22 07:54
Quadrature Decoder / WKUP
Quadrature Decoder / WKUP controller SW3 button to start/stop Quadec polling SW2 button to terminate Quadec test Quadrature Decoder Test started!. Press SW2 button to terminate test. Quadec ISR report: > First encoder turn DX: 0002 DY: 0000 DZ: 0000 Quadec ISR report: >Fourth encoder turn DX: 0015 DY: 0000 DZ: 0000 Quadec ISR report: >Eighth encoder turn DX: 0023 DY: 0000 DZ: 0000

I tested your proposition (a clean quadrature_decoder example, i change only encoder and uart pins), and encoder still doesn't work properly... I see an event only when turn (left or right) encoder four times (sometimes after one turn). In attachment oscilloscope diagrams (A and B encoder pins on blue and yellow lines, the first picture shows first turn, second pictures shows next turns). Maybe i have the wrong type of encoder?

Attachment:
PM\U对话框
Offline
最后一次见到:17 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi adam.stroz,

Hi adam.stroz,

谢谢你来论坛发帖。令人兴奋的消息!我们现在正在移动到我们的新论坛平台,将提供更好的功能,并包含在主对话网站的过程。所有帖子和账号都已迁移。我们现在只接受新论坛上的流量-请在//www.xmece.com/support

We’ll be fixing bugs / optimizing the searching and tagging over the coming days.

This ticket has been posted on ://www.xmece.com/亚博电竞菠菜products/bluetooth-low-energy?post_id=11435#tab-支持#tab内容

Your last comment is not sync-up, so I’ll create a copy (with the attachment) on behalf of you.

我会在新的论坛帖子上尽快回复你。

谢谢,下午好