cancel
Showing results for 
Search instead for 
Did you mean: 

Suggestion for encoder reading configuration on available pins?

Ricko
Senior III

Hi,

I am working on the electronics design and configuring the micro through CubeMX to decide which pins to connect to which pins.

We need to read a quadrature encoder (ideally also with the index) and at the moment we have wired the micro/PCB as per attached IOC file.

 

The pins that we would like to use are: uC_IO_EXP_1, uC_IO_EXP_2, uC_IO_EXP_3 and uC_IO_EXP_4 because they are the ones that go to the external PCBs (currently set to "pinned" in the IOC file). But with the current timer configuration the encoder mode does not seem to be available on those pins despite being timer pins.

 

I tried rearranging timers and functionality, but haven't yet found a way to enable the encoder functionality. Could someone kindly help with the configuration (or suggestions about it)?

 

The only constraint is that as long as the other PWM signals (they are named with "PWM" in them) provide a PWM output on those pins, the timer currently assigned to them can be changed to another one.

 

If it is not possible then could you please suggest the next lowest CPU intensive solution that use some peripheral (i.e. not GPIO interrupts because the speed of the encoder can sometimes be quite high and we want to leave plenty of room for CPU to do very many CPU intensive other tasks in the future).

 

Any suggestion is very much appreciated.

 

Thank you as always :)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

You've already answered yourself: any solution which does not involve hardware redesign, is software intensive.

The canonical encoder readout in software is through a periodical process, where period is shorter than half of the shortest anticipated distance between input signal edges. Although in German, a very good treatise of the problem is at https://www.mikrocontroller.net/articles/Drehgeber .

JW

View solution in original post

3 REPLIES 3
Ricko
Senior III

Could anybody please help with this?

It would be very much appreciated :)

You've already answered yourself: any solution which does not involve hardware redesign, is software intensive.

The canonical encoder readout in software is through a periodical process, where period is shorter than half of the shortest anticipated distance between input signal edges. Although in German, a very good treatise of the problem is at https://www.mikrocontroller.net/articles/Drehgeber .

JW

Thank you @waclawek.jan