Description
Hi !
I am having more issues with timers and CircuitPython using a SAMD51G19A this time.
I have been doing some testing and discovered that the CircuitPython is reporting that all timers are being used. I have done a table check and think this might be wrong or not using all the available channels. - happy to be told otherwise.
From the Datasheet
Servo | Pin | TC | TCC | TCC |
---|---|---|---|---|
8 | PA08 | 0.0 | 0.0 | 1.4 |
7 | PA09 | 0.1 | 0.1 | 1.5 |
6 | PA10 | 1.0 | 0.2 | 1.6 |
5 | PA11 | 1.1 | 0.3 | 1.7 |
1 | PA18 | 3.0 | 1.2 | 0.6 |
2 | PA19 | 3.1 | 1.3 | 0.7 |
3 | PA20 | 7.0* | 1.4 | 0.0 |
4 | PA21 | 7.1* | 1.5 | 0.1 |
- not available
I am aware of:
- TC channel 0 cannot be used as per Support PWM on TCx_0 pins #1766 Set timers for CircuitPython Manually #1776
- TC7 does not exist
- TCC0 and TCC1 should both have 6 Compare/Capture channels (12 total)
Test One:
[INFO] START - SERVO Test
Initialising all servo Pins. There could be errors at this stage relating to timers. Swap pins to remove errors and note in documentation.
[LOOP] Initialising...microcontroller.pin.SERVO1
[LOOP] Initialising...microcontroller.pin.SERVO2
[LOOP] Initialising...microcontroller.pin.SERVO3
[LOOP] Initialising...microcontroller.pin.SERVO4
[LOOP] Initialising...microcontroller.pin.SERVO5
[LOOP] Initialising...microcontroller.pin.SERVO6
[LOOP] Initialising...microcontroller.pin.SERVO7
[LOOP] Initialising...microcontroller.pin.SERVO8
Traceback (most recent call last):
File "code.py", line 106, in <module>
ValueError: All timers for this pin are in use
Looks like a "not enough timers" failure on SERVO8 (PA08). However I believe the first TCC timer should be selected TCC0[0] because it is not used. Servo 1 to 4 should choose the TCC1 and Servo 5 to 7 are exclusive TCC0 channels.
Test Two:
[INFO] START - SERVO Test
Initialising all servo Pins. There could be errors at this stage relating to timers. Swap pins to remove errors and note in documentation.
[LOOP] Initialising...microcontroller.pin.SERVO5
[LOOP] Initialising...microcontroller.pin.SERVO6
[LOOP] Initialising...microcontroller.pin.SERVO7
[LOOP] Initialising...microcontroller.pin.SERVO8
[LOOP] Initialising...microcontroller.pin.SERVO1
[LOOP] Initialising...microcontroller.pin.SERVO2
[LOOP] Initialising...microcontroller.pin.SERVO3
Traceback (most recent call last):
File "code.py", line 105, in <module>
RuntimeError: All timers in use
This looks like a different error telling me that CircuitPython cannot function because I used all the timers before I got to SERVO4.
I am at a bit of a loss of what is happening here - I would have thought having up to 3 timers to choose from would result in no issues.
Is there anyway to get debug output of which timers CircuitPython is selecting?
Thanks in advance for any assistance.