Sign in to follow this  
Followers 0
julle

Optimize encoders processing

2 posts in this topic

Hi,

i am trying to optimize something in the code of my midibox to be able to do some nice backspins with my dj-controller. It got the following setup:

  • stm32f4 discovery board
  • 1x DINX4
  • Encoders connected via DINX4
  • Custom written MIOS app

I use encoders with mounted jogwheels to create relative CC-midimessages for usage in MIXXX. If i do a fast backspin (should be 30CC val1) with the jogwheel, the board seems to be not capable of processing these fast movements. It is only creating midimessages if the speed of the jogwheel already decreased. Additionally values for the wrong direction (30CC val127) appear:

<<< Backspinn start >>>
[9799.634] be 1e 01   Chn#15  CC# 30 = 1
[9799.670] be 1e 7f   Chn#15  CC# 30 = 127
[9799.748] be 1e 7f   Chn#15  CC# 30 = 127
[9799.807] be 1e 01   Chn#15  CC# 30 = 1
[9799.838] be 1e 7f   Chn#15  CC# 30 = 127
[9799.878] be 1e 01   Chn#15  CC# 30 = 1
[9799.891] be 1e 01   Chn#15  CC# 30 = 1
[9799.926] be 1e 7f   Chn#15  CC# 30 = 127
[9799.965] be 1e 01   Chn#15  CC# 30 = 1
[9799.980] be 1e 01   Chn#15  CC# 30 = 1
[9799.996] be 1e 01   Chn#15  CC# 30 = 1
[9799.999] be 1e 01   Chn#15  CC# 30 = 1
[9800.029] be 1e 01   Chn#15  CC# 30 = 1
[9800.047] be 1e 01   Chn#15  CC# 30 = 1
[9800.068] be 1e 01   Chn#15  CC# 30 = 1
[9800.091] be 1e 01   Chn#15  CC# 30 = 1
[9800.095] be 1e 01   Chn#15  CC# 30 = 1
[9800.116] be 1e 01   Chn#15  CC# 30 = 1
[9800.143] be 1e 01   Chn#15  CC# 30 = 1
[9800.178] be 1e 01   Chn#15  CC# 30 = 1
[9800.223] be 1e 01   Chn#15  CC# 30 = 1
  <<< Jogwheel stopped rotating >>>

I think the wrong values are related to the lack of debouncing of encoders as described in the thread below: thread

I already tried some tweaks for some faster processing but these approaches are more trial-and-error based, as i think i havent understood all aspects of the scheduling via freertos. But i guess i understood the nice MIOS-Flowchart from the wiki.

These were my approaches:

  1. Change priority of the TASK_Hooks to higher value (but I think it does not make sense...)
  2. Try to call vApplicationTickHook via a MIOS timer every 100us as it is usually only called every 1ms ( is this right?)
  3. Optimize SRIO for fast speed:
 MIOS32_SRIO_ScanNumSet(3);
 MIOS32_SPI_TransferModeInit(MIOS32_SRIO_SPI, MIOS32_SPI_MODE_CLK1_PHASE1, MIOS32_SPI_PRESCALER_8);

As you can see i tried to some dirty things, but so far, there was no improvement. So i got two questions:

  1. Is it possible to put some more processing ressources on the processing of the encoder-signals? (Scheduling, using GPIO-Interrupts by connecting the encoders to J5, ... )
  2. Or is the STM32F4 already running on fastest speed to process everything as fast as possible?

Thank you, 

Julian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0