-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Portenta H7: ADC Implementation #76
Comments
As @mjs513 mentioned, the test sketch output: GPIOC FFFFAAAA 22BB55BA 0 I was curious, so I hacked up a version like pinMode to try to set the pin to Analog.
I found it could change the MODER register to 0's which is Analog, but still not getting valid analog from those I noticed it left the AF field in the other register as 5, but not sure that matters. May try to use the RAW version instead. |
The Analog issues on the Portenta H7, actually two main issues. First issue: Duplicate pins: I have sort of fix for this, in that in the pin Table for 19,20, I changed them to Z4 and Z5, but I did not change that in the Analog to GPIO table, so A4=10 and A5=8, and those work.
These are up in my Fork/Branch: https://github.com/KurtE/ArduinoCore-zephyr/tree/Portenta_h7_spi_uart_pin_names The digital code for D19/D20 will fail, as there is no glue. However, if you hook up anything to this pin D20 and do any The confusion on some of these pins is not new, there was a thread about these pins almost 3 years ago;
There is nothing to switch the two bits in the appropriate MODER register (back) to 0x3 There may be a hack that can work for STM32 boards, in maybe calling gpio_pin_configure_dt or gpio_pin_configure
However these flags may be specific for STM32... boards, maybe not supported by Portenta C33, or UNO R4 or ... |
Taking a look at the C33 stuff, I don't see any logical GPIO settings of Analog for the Renesas processors, so I don't think the approach of trying some gpio_pin_configure will work in this case. Wondering with the init/deinit PR that was pulled in (post new release). What is the granularity of it? |
In order to get ADC working on the H7 used the Giga Overlay as the model. The following changes were made to the arduino_portenta_h7_m7.overlay:
In the conf file enabled
CONFIG_ADC=y
Also added the pure_analog_pins,h and ,cpp files modified to use the H7 Analog Pins A0-A3.
Rung out the analog pins a0-a7 using a analog joystick from adafruit:
While A0-A3 and A6/A7 worked as expected found A4 and A5 were non operational. We tried a few things but no luck.
@KurtE instrumented a simple test sketch to print out the pin configs
and found that pins A4 and A5 modes were set to AF5 which according to the spec
identifed a4 and a5 as MISO and MOSI for SPI2.
@KurtE found there was an open issue [RFC] Add device init/de-init functionality in Zephyr related to this.
So besides some PWM pins being non-operational we now have some analog pins non-operational.
The text was updated successfully, but these errors were encountered: