Jump to content

Optimize encoders processing


julle
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...