Remora - ethernet NVEM / EC300 / EC500 cnc board

More
3 years 3 weeks ago #282510 by rbobey1989
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.

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #282516 by scotta
Again, thanks for the work on the hardware encoder implementation. I've just been reviewing the STM32 version and there are a few things that we should consider for the RT1052 version.

1. The QEI version runs the module in the Base thread so that we have absolutely the latest encoder count when a PRU read request is received.

2. The index is an interrupt pin with the ISR getting the encode count, not waiting for the next thread period to run.

3. By having the index on it's own interrupt, not the QDC module index input, the board could support a total of 4 hardware encoders.. correct.

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #282517 by scotta

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #282521 by rbobey1989
Sincerely thanks for the response, sometimes ideas and experience are worth more than the implementation itself, a good approach is to change the QDC module to the base thread, I have not tried it in the base thread, in fact I saw that in some firmware versions If you used it in one thread or another, in the base thread we would obtain a better sampling rate. I thought about the issue of interruption due to the index event this afternoon. In fact, I'm already working on it. There is an example in the SDK.

What I do not agree with is that we do not have pins to use the 4 hardware encoders at the same time, we only have 6 pins that we can connect to the encoders through XBARA1, at least I did not find more, the encoders can be used interchangeably

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #282529 by virencq
Is there any feasibility/possibility of implementing DMAstepgen in the Remora branch with Mbed OS?

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #282554 by rbobey1989
Hello Scott, I have added the index interruption and registered the module in the base thread, I have also added the instance for the ENC4 although without physical pins mmmmm, it seems to work well, now looking at the digital filter, it would be the last addition, the latest changes in my repository , greetings
The following user(s) said Thank You: scotta

Please Log in or Create an account to join the conversation.

Time to create page: 0.230 seconds
Powered by Kunena Forum