I'm still researching Remora, you never stop learning, as it says in the remora documentation Index signal is shared with the digital input pin, that is, the databit on the pin where we physically connect index pin must be set in the QDC configuration as well: or it would look like this:
{
"Thread": "Servo",
"Type": "QDC",
"Comment": "QDC Encoder A-IN11 B-IN12 I-IN14",
"PV": 1,
"Data Bit": 17.
"ChA Pin": "P4_00",
"ChB Pin": "P3_23",
"Index Pin": "P4_15",
"ENC No": 2
},
since in firmware *(this->ptrData) points to the inputs and this->mask= 1 << this->bitNumber
set the index input *(this->ptrData) |= this->mask;
clear the index input *(this->ptrData) &= ~this->mask;
everything working now although with some modifications, I was looking at the functions included in the QDC driver fsl_enc.c:
uint32_t ENC_GetPositionValue(ENC_Type *base)
{
uint32_t ret32;
ret32 = base->UPOS; /* Get upper 16 bits and make a snapshot. */
ret32 <<= 16U;
ret32 |= base->LPOSH; /* Get lower 16 bits from hold register. */
return ret32;
}
and,
uint32_t ENC_GetHoldPositionValue(ENC_Type *base)
{
uint32_t ret32;
ret32 = base->UPOSH; /* Get upper 16 bits and make a snapshot. */
ret32 <<= 16U;
ret32 |= base->LPOSH; /* Get lower 16 bits from hold register. */
return ret32;
}
In the ENC_GetHoldPositionValue function, the LPOSH is already obtained. I don't know the intention of this, but when I read the ENC_GetHoldPositionValue I do not have a correct reading. According to the reference manual, when the POS, POSD, REV registers are read, a snapshot is made of the corresponding hold registers. I have carried out tests modifying the fsl_enc.c reading LPOS that is:
uint32_t uint32_t ENC_GetHoldPositionValue(ENC_Type *base)
{
uint32_t ret32;
ret32 = base->UPOS; /* Get upper 16 bits and make a snapshot. */
ret32 <<= 16U;
ret32 |= base->LPOS; /* Get lower 16 bits and make a snapshot. */
return ret32;
}
In order to then pass the reading of ENC_GetHoldPositionValue() But I keep getting the wrong reading, where I get a moderately correct count is by using the ENC_GetPositionValue() function at the beginning of the QDC::Update function, I say moderately because the values do not match 100%. sim_encoder.raw_counts values with what I get through remora.PV.1, difference of 4 counts, if I can say anything it is that the dupont cables must help a lot.