Skip to content

Conversation

hierophect
Copy link
Collaborator

@hierophect hierophect commented Jul 1, 2020

This PR adds a timer management system to the peripherals/ directory, which mediates how modules are granted timers out of all timer peripherals available for a given STM32 SoC. It also adjusts the PulseIO modules to use ST's "General Purpose" and "Advanced" timers, in addition to the "Basic" ones. Once a module has claimed a timer, it cannot be used by other modules - thus, the timer search function attempts to select timers with minimal exposure to pins wherever possible.

This PR is working for basic PulseIO tests, but is still incomplete. Steps remaining include:

  • Fix advanced search methods
  • Enable RGBMatrix
  • Fully test PulseIn, PulseIO combination
  • Re-generate timer peripheral files to include complete timer instance list

@jepler, any advice you might have on adjusting RGBMatrix to fit this system would be appreciated.

@hierophect hierophect requested a review from jepler July 1, 2020 14:49
@hierophect hierophect marked this pull request as ready for review July 9, 2020 20:46
@hierophect hierophect requested a review from tannewt July 9, 2020 20:47
@hierophect
Copy link
Collaborator Author

@jepler this is ready for your review now, alongside adafruit/Adafruit_Protomatter#14

@tannewt tannewt removed their request for review July 10, 2020 18:17
@tannewt
Copy link
Member

tannewt commented Jul 10, 2020

@jepler Can be the sole reviewer. @hierophect you'll want to check fix the CI.

@hierophect
Copy link
Collaborator Author

@tannewt sounds good. Translations fix pushed, hopefully that will resolve CI issue. I'm currently investigating a PulseIn regression on main that I may want to fold into this.

@jepler
Copy link

jepler commented Jul 10, 2020

/usr/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: build-feather_stm32f405_express/lib/protomatter/core.o: in function `TIM6_DAC_IRQHandler':
/home/runner/work/circuitpython/circuitpython/ports/stm/../../lib/protomatter/arch.h:811: multiple definition of `TIM6_DAC_IRQHandler'; build-feather_stm32f405_express/peripherals/timers.o:/home/runner/work/circuitpython/circuitpython/ports/stm/peripherals/timers.c:341: first defined here

protomatter will need to be updated to remove the hard coded IRQHandler, and the one in CircuitPython will need to call into protomatter. Tag me on discord if this doesn't make sense.

@hierophect
Copy link
Collaborator Author

Requires adafruit/Adafruit_Protomatter#14

Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some suggestions of things to change or double check.

Protomatter submodule update looks right, gitk says:

  > Fix NRF compile warning issue
  > Merge branch 'master' into cpy-timer-allocator
  > cpy-timer-allocator
  > Merge pull request #12 from adafruit/teensy4
  > Merge pull request #9 from adafruit/actionsci
  > Merge pull request #7 from jepler/circuitpython-build-fix
  > Merge pull request #8 from adafruit/esp32
  > Fix clang-format detail
  > clang-format the lot
  > Use TC3 on SAMD's that lack a TC4
  > Create .travis.yml
  > Doxygenate
  > Update README.md for Travis and library.properties for version #

This requires adafruit/Adafruit_Protomatter#14 to be merged before this can be merged.

Testing performed: None

@tannewt
Copy link
Member

tannewt commented Jul 21, 2020

Where is this PR at?

@hierophect
Copy link
Collaborator Author

hierophect commented Jul 21, 2020

@tannewt I put it down to wrap up PWMOut on the ESP32-S2, still gotta address Jeff's comments. Probably can get that done today or early tomorrow.

@jepler
Copy link

jepler commented Jul 22, 2020

I can rereview when you're ready, @ me

@hierophect hierophect requested a review from jepler July 22, 2020 18:01
@hierophect
Copy link
Collaborator Author

@jepler Ok this passes on my machine and should be good for another review.

@hierophect
Copy link
Collaborator Author

The CI failure here appears to be RISCV related, so it shouldn't hold this up.

@jepler
Copy link

jepler commented Jul 23, 2020

OK, I have one semi-question, feel free to merge if the answer is "yes it's fine that way" and CI is happy.

@hierophect hierophect merged commit c735dce into adafruit:main Jul 24, 2020
@hierophect hierophect deleted the stm32-timer-allocator branch July 24, 2020 15:16
@hierophect
Copy link
Collaborator Author

Everything's working and the one CI failure seems extraneous, so I've merged this. I'll keep working on the RGBMatrix fix as a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants