-
-
Notifications
You must be signed in to change notification settings - Fork 16
GIGA: analogWrite(5, 0); faults the processor - Analog APIS are not complete #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Updated the code so does not fault:
57 0 83 11 6 80 81 3 4 Now to figure out what those pins are ... I see them defined as:
But I think <&arduino_header 5 0>, is not pin not D5 |
Yep found that in #7 as well where"
just noticed though that @facchinm has some comits to fix the pin numbering - see bottom of issue And yeah don't understand the pin table either. PS sorry been missing all the fun been sick as a dog. |
Edited title as I don't believe that these APIs are complete: That is, on Arduino analogWrite(pin, value), the value is I believe defined as the range of 0-resolution or fir 8 bits 255. The current code: simply calls: with the value passed in, it compares the value to be between 0 and the period, and the So the period is the time in us. So we should map the value something like: analogWriteResolution is not defined or implemented, to allow to change resolution typically between 8 and 12 bits What about the DAC pins (A12 and A13) Having difficulties trying to figure out the .dts/.overlay files on how to specify PWM pins. Also trying to figure out the multiple sections associated with the camera PWM pin. More on this later... |
Quick update: I am having a little luck with PWM. I have Pin 10 limping along, maybe 12 as well have not tried it.. Sections in the overlay with PWM stuff:
Analog write in zephyrcommon.cpp
Note currently Pin 10 is outputting at 20mhz pulses. I tried 500 and saw lots of errors about the period does not fit Test Sketch:
MBED Zephyr CR1: 0x1 CR1: 0x81
|
Quick update: using different sketch which allows me to enter pin and value, to see what happens.
So far PWM only works on Timer1.
Output on Serial1 ...
Here are the changed files: The conf and overlay files are in the normal places. zephyrCommon.cpp is in the cores/arduino directory
Pin 2 is on Timer15:
Pin 10 is on TImer 1:
Feels like it is missing glue to read in the other PWM timers and fill in things like CCR1... |
Describe the bug
analogWrite(5, 0);
Faults on the GIGA...
Output of Serial Monitor
Optional: attach the sketch
Additional context
Add any other context about the problem here.
Instrumented the code:
Debug output:
So the line: size_t idx = pwm_pin_index(pinNumber);
returns: 0xffffffff which is obviously > idx >= ARRAY_SIZE(arduino_pwm)
which is checked, unfortunately after the code:
if (!pwm_is_ready_dt(&arduino_pwm[idx])) {
which faulted.
Will swap some code next. But wonder why 5 is not returning a valid index...
The text was updated successfully, but these errors were encountered: