POSQE001: Can't use revolution counter

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Not applicable
In POSQE001, I can't use the revolution counter.

When having it selected, the solver fails with the message "Resource mapping failed, please review the user defined constraints."

885.attach

This also happens, when there's no Position Counter Overflow Event and no Direction Change Event selected:

886.attach

What am I doing wrong?

Setup is an XMC4500 Relaxe Lite development board connected to an HEDS quadrature encoder. Position counting, and index events are working fine (when Revolution counter is not selected, Solver solves and code is generated).
Software is DAVE 3.1.10 with Apps updated to the latest versions.
0 Likes
4 Replies
lock attach
Attachments are accessible only for community members.
Funmix
Employee
Employee
5 sign-ins 25 replies posted 10 replies posted
Hi soenke,

It always important to check the chip resources when you want to implement the features on your system. Please refer to the attached technical document regarding POSIF connection for position counter, event counter, revolution counter and etc. Please check also the hardware connection of XMC4x.
0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Thank you cery much for your reply - the problem above had been solved by starting a new project. I wasn't able to hunt down the problem, but supposedly there were some leftovers from an example project for a different target chip.

Nevertheless I'm still struggling with using the revolution counter.
I'm using POSQE001 with an A/B/I quadrature encoder (HEDS-5545 type). Electrical connections and signals are fine. Device is XMC4500-F100x1024-AB on a Relax Lite devboard, which is also selected in Dave3.
I'm able to get the position with POSQE001_GetPosition(&POSQE001_Handle0, &position, POSQE001_READ_TIMER), but POSQE001_GetRevolutions(&POSQE001_Handle0, &revolutions, POSQE001_READ_TIMER) doesn't go further than to the first index (revolutioncounter going from 0 to 1).

When attaching the index event to an interrupt, the interrupt gets only triggered on the first index occurence.
The "clear on first index event" comes into my mind, but it was either disabled or set to clear on every index.
Tried with both velocity calculation profile disabled, and profile 1. Every time before running, I've run it through the code generation, solver, make clean, build, upload steps to be sure the code made it onto the µC.

Resource Mapping report shows revolutioncounter mapped to ccu4/0/cc4/2 by default. I then manually mapped it to ccu4/0/cc4/1 as shown in XMC4500 manual Figure 24-17 Quadrature Decoder Mode usage - profile 1, but this made no difference.

/*
* Main.c
* Note: printf() outputs to UART
*/

#include //Declarations from DAVE3 Code Generation (includes SFR declaration)
#include

uint16_t enc_index = 0;
void I_EncIndex()
{
printf("Index: %u\r\n", ++enc_index);
}

uint16_t position = 0;
uint16_t old_position = 0;
uint16_t revolutions = 0;

int main(void)
{
// status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)


DAVE_Init(); // Initialization of DAVE Apps

NVIC002_EnableIRQ(&NVIC002_Handle0);

while(1)
{
old_position = position;
POSQE001_GetPosition(&POSQE001_Handle0, &position, POSQE001_READ_TIMER);
POSQE001_GetRevolutions(&POSQE001_Handle0, &revolutions, POSQE001_READ_TIMER);
if (position != old_position)
{
printf("Pos: %4u Revolutions: %4u\r\n", position, revolutions);
IO004_TogglePin(IO004_Handle0);
}

}
return 0;
}


Output via serial:

Pos: 1302 Revolutions: 0
Pos: 1303 Revolutions: 0
Index: 1
Pos: 1304 Revolutions: 1
Pos: 1305 Revolutions: 1
...
Pos: 1302 Revolutions: 1
Pos: 1303 Revolutions: 1
Pos: 1304 Revolutions: 1
Pos: 1305 Revolutions: 1


Signal assignments:
App,Signal,Connected To,App,Signal
CCU4GLOBAL/0,Clock,<----,CLK001/0,CCU Clock
IO004/0,Pin Signal,<----,IO004/0,Software Controlled Output Signal
POSQE001/0,Global signal for Position Counter,<----,CCU4GLOBAL/0,Global
POSQE001/0,Global signal for Revolution Counter,<----,CCU4GLOBAL/0,Global
POSQE001/0,Index,<----,POSQE001/0,Quadrature Encoder Index
POSQE001/0,Interrupt - Index Event,---->,NVIC002/0[I_EncIndex],Interrupt Node
POSQE001/0,PhaseA,<----,POSQE001/0,Quadrature Encoder Phase A
POSQE001/0,PhaseB,<----,POSQE001/0,Quadrature Encoder Phase B
POSQE001/0,POSIF Output - Direction,---->,POSQE001/0,Position Counter - Event1
POSQE001/0,POSIF Output - Index,---->,POSQE001/0,Revolution Counter - Event0
POSQE001/0,POSIF Output - Quadrature Clock,---->,POSQE001/0,Position Counter - Event0
UART001/0,Receive Pin,---->,UART001/0,UART DX0 Input Stage
UART001/0,Transmit Pin,<----,UART001/0,UART Tx Pin


Resource mappings:
App,ProxyResource,Mapped Resource
CCU4GLOBAL/0,global,ccu4/0/global
CLK001/0,ccu,scu/0/clkctrl/0/ccu
CLK001/0,clk_extpin,
CLK001/0,cpu,scu/0/clkctrl/0/cpu
CLK001/0,ebu,scu/0/clkctrl/0/ebu
CLK001/0,hibernate,scu/0/pwrctrl/0/hibernate
CLK001/0,mmc,scu/0/clkctrl/0/sdmmc
CLK001/0,perbridge,scu/0/clkctrl/0/perbridge
CLK001/0,pll,scu/0/clkctrl/0/pll
CLK001/0,rgextclk,scu/0/clkctrl/0/extclk
CLK001/0,rtcclksel,scu/0/rtcclksel
CLK001/0,sys,scu/0/clkctrl/0/sys
CLK001/0,usb,scu/0/clkctrl/0/usb
CLK001/0,wdt,scu/0/clkctrl/0/wdt
IO004/0,pin,p/1/pad/1
NVIC002/0[I_EncIndex],nvicnode,cpu/0/nvic/interrupt/69
POSQE001/0,index,p/14/pad/5
POSQE001/0,phasea,p/1/pad/3
POSQE001/0,phaseb,p/1/pad/2
POSQE001/0,posif,posif/0/posif
POSQE001/0,positioncounter,ccu4/0/cc4/0
POSQE001/0,revolutioncounter,ccu4/0/cc4/1
POSQE001/0,velocitycounter0,
POSQE001/0,velocitytimer0,
POSQE001/0,velocitytimer1,
RESET001/0,ccu4reset0,scu/0/rstctrl/0/ccu4reset/0
RESET001/0,ccu4reset1,scu/0/rstctrl/0/ccu4reset/1
RESET001/0,ccu4reset2,scu/0/rstctrl/0/ccu4reset/2
RESET001/0,ccu4reset3,scu/0/rstctrl/0/ccu4reset/3
RESET001/0,ccu8reset0,scu/0/rstctrl/0/ccu8reset/0
RESET001/0,ccu8reset1,scu/0/rstctrl/0/ccu8reset/1
RESET001/0,dacreset,scu/0/rstctrl/0/dacreset
RESET001/0,dmareset0,scu/0/rstctrl/0/dmareset/0
RESET001/0,dmareset1,scu/0/rstctrl/0/dmareset/1
RESET001/0,dsdreset,scu/0/rstctrl/0/dsdreset
RESET001/0,ebureset,scu/0/rstctrl/0/ebureset
RESET001/0,eru1reset,scu/0/rstctrl/0/eru1reset
RESET001/0,ethreset,scu/0/rstctrl/0/ethreset
RESET001/0,fcereset,scu/0/rstctrl/0/fcereset
RESET001/0,hrpwmreset,
RESET001/0,ledtsreset,scu/0/rstctrl/0/ledtsreset
RESET001/0,mcanreset,scu/0/rstctrl/0/mcanreset
RESET001/0,mmcreset,scu/0/rstctrl/0/mmcreset
RESET001/0,posifreset0,scu/0/rstctrl/0/posifreset/0
RESET001/0,posifreset1,scu/0/rstctrl/0/posifreset/1
RESET001/0,pportreset,scu/0/rstctrl/0/pportreset
RESET001/0,rcurst,scu/0/rstctrl/0/rcurst
RESET001/0,usbreset,scu/0/rstctrl/0/usbreset
RESET001/0,usicreset0,scu/0/rstctrl/0/usicreset/0
RESET001/0,usicreset1,scu/0/rstctrl/0/usicreset/1
RESET001/0,usicreset2,scu/0/rstctrl/0/usicreset/2
RESET001/0,vadcreset,scu/0/rstctrl/0/vadcreset
RESET001/0,wdtreset,scu/0/rstctrl/0/wdtreset
UART001/0,channel,usic/1/channel/0
UART002/0,UART Receive,p/2/pad/15
UART001/0,UART Transmit,p/2/pad/14


Pin assignment:
App,Signal,Port-Pin,Pin Number
IO004/0,pin,P1.1,#78
POSQE001/0,phasea,P1.3,#76
POSQE001/0,phaseb,P1.2,#77
POSQE001/0,index,P14.5,#26
UART001/0,UART Receive,P2.15,#40
UART001/0,UART Transmit,P2.14,#41


I'm really stuck now.

Anybody having a proved-working example for the XMC4500 relax lite devboard with a quadrature a/b/i encoder to get position (ok, works for me), revolutions (POSQE001_GetRevolutions), and maybe velocity? Thank you very much in advance for your help.
0 Likes
Not applicable
I had some success.

First, I've set the Index Marker generations control (ICM) bits in POSIF0.QDC to generate all index ocurrences on POSIF0.OUT3.
Then I made CCU40_CC41 to use pin CCU40.IN1G (which is connected to POSIF.OUT3) as Event 0 (counting) signal, not CCU40.IN1H (connected to POSIF.OUT4).

	// ICM Index Marker generations control (2) All index occurrences generated on POSIFx.OUT3 (index)
POSIF0->QDC &= ~((uint32_t)0x3U<< (uint32_t) 4);
POSIF0->QDC |= ((uint32_t)0x2U<< (uint32_t) 4);
// Set Event 0 signal selection to CCU40.IN1G (connected to POSIF0.OUT3)
CCU40_CC41->INS &= ~((uint32_t)0xfU<< (uint32_t) 0);
CCU40_CC41->INS |= ((uint32_t)0x6U<< (uint32_t) 0);


I still have absolutely no clue, why POSIF0.OUT4 isn't working (but POSIF0.OUT3 is doing fine), and why the POSIF0_1_IRQHandler interrupt routine is only entered on the first occurence of the index signal.
Any help/explanation?

I found an issue in the XMC4500 AB errata sheet "POSIF_AI.001 Input Index signal from Rotary Encoder is not decoded when the length is 1/4 of the tick period". The datasheet of my HEDS5545 states 1/4 cycle for the index signal...
0 Likes
Not applicable
Hi Soenke,

It has been forwarded further. Will update you once get reply.

Best regards,
Sophia
0 Likes