-
-
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: Add spis/wires to overlay plus fix GPIOS #71
Conversation
94b0159
to
613c968
Compare
In regards to @KurtE Tested with other sketches to ensure it all worked: Did notice that if you try to use LED_BUILTIN it casues as usage fault on unaligned memory access - verified by running the Blink.ino example sketch! |
2a1f4a9
to
42b2493
Compare
Any idea when this PR will be incorporated? Waiting to synch up? |
This is a partial fix for: arduino#68 the spis line was not in the zephyr,user { section of the ovleray file. I added it with one entry: spis = <&spi2>; Updated: the GPIO table, that only the LEDS should be defined with GPIO_ACTIVE_LOW.
Added in the other two Wire objects to match the MBED version. i2cs = <&i2c3>, <&i2c1>, <&i2c4>; I checked it out with simple wire scanner sketch that checks Wire, Wire1 and Wire2. And then tried adding QWIIC Button first to the I2C0 section of breakout board and it was found on Wire. Moved it to I2C1 section and found with Wire1 and then moved to I2C2 section and found on Wire2
resolves: arduino#74 needed to add: CONFIG_MEMC=y to have the SDRAM enabled and as such not fault if you do anything with the SDRAM library. Also enabled CONFIG_DMA=y As not sure if that was needed but is in the GIGA .conf file Update arduino_portenta_h7_m7.overlay Add dma sections to remove the build warnings
@mjs513 and I added/modified the device tree for this board, with the tables to support PWM (analogWrite) and analogRead on some of the Analog pins. Note: there are some issues with A4/A5 in that those pins are also on the same pins that support SPI. And when SPI is enabled, the GPIOC pin configuration is setup by the device tree to be MODER to be set for Alternat function and their AF set to 5. The analogRead code does not does not update these tables and as such analogRead fails. We found that if y ou disable SPI then they work better. I currently left the SPI enabled. Probably need to add something that when analogRead is called that it updates the GPIO registers to make it work. I am ecurrently experimenting with a hack in my test sketch that appears to change the MODER of those pins back to 3, but so far that does not appear to be sufficent: ``` static const struct gpio_dt_spec arduino_pins[] = {DT_FOREACH_PROP_ELEM_SEP( DT_PATH(zephyr_user), digital_pin_gpios, GPIO_DT_SPEC_GET_BY_IDX, (, ))}; void pinModeAnalog(pin_size_t pinNumber) { gpio_pin_configure_dt(&arduino_pins[pinNumber], GPIO_INPUT /*| GPIO_ACTIVE_HIGH */ | GPIO_MODE_ANALOG); } ``` On the analogWrites, this code has optionally in place that allows duplicate pins in the device tree GPIO list, by changing how I read in the PWM table from the Tree, instead of summing all of the matches in the GPIO tree, it instead saves the GPIO Port and pin number and uses them for the compare. Again this depends on if we wish for the Pin numbers for the functions like digitalRead/digitalWrite to match those used by the MBED version. I still have the last 3 truncated K5-K7 which are used by the LEDs and fault but depending on directions, can find other solutions. enable spi2
42b2493
to
c2f829b
Compare
I just rebased this branch to the current stuff in the Arduino branch. Will play with it soon, to see if the merges did not break stuff... Also I could reduce these tables if desired and maybe add a PinTable.h like file to do mappings. I am assuming that we don't want to duplicate the LED code many times over where we add something to the users list and then use iterator to convert to the pin number (currently the sum of all pin numbers whose pin info matches the LED pin info) |
This is sort of a hand merge of PR arduino#82 which supersedes arduino#71 Adds in the SPI, Wire, Some Analog, some PWM, access to all of the pins. This has a reduced full pin table, but also introduced the use of pin names using slightly stripped down table that was used for MBED version
This is a replacement for PR: arduino#71 and arduino#82. All of the earlier commits were squashed into one. Then this was converted a few times during the arduino#85 pr time frame as things kept changing and moving around. It has now been updated to the released .3 version. I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines. I later reduced this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite. We defined the additional SPI ports and Wire ports. We defined an initial setup for Analog pins. Have similar hack to GIGA version for pure Analog. Added additional hacks for duplicated pins. That is two of the analog Pins are the exact same pin as some other digital pins... Added some PWM support. Also added WIP: camera support. Co-Authored-By: Mike S <[email protected]>
Closed this one as it is for the old project layout ... |
This is a replacement for PR: arduino#71 and arduino#82. All of the earlier commits were squashed into one. Then this was converted a few times during the arduino#85 pr time frame as things kept changing and moving around. It has now been updated to the released .3 version. I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines. I later reduced this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite. We defined the additional SPI ports and Wire ports. We defined an initial setup for Analog pins. Have similar hack to GIGA version for pure Analog. Added additional hacks for duplicated pins. That is two of the analog Pins are the exact same pin as some other digital pins... Added some PWM support. Also added WIP: camera support. Co-Authored-By: Mike S <[email protected]>
This is a replacement for PR: arduino#71 and arduino#82. All of the earlier commits were squashed into one. Then this was converted a few times during the arduino#85 pr time frame as things kept changing and moving around. It has now been updated to the released .3 version. I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines. I later reduced this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite. We defined the additional SPI ports and Wire ports. We defined an initial setup for Analog pins. Have similar hack to GIGA version for pure Analog. Added additional hacks for duplicated pins. That is two of the analog Pins are the exact same pin as some other digital pins... Added some PWM support. Also added WIP: camera support. Co-Authored-By: Mike S <[email protected]>
This is a replacement for PR: arduino#71 and arduino#82. All of the earlier commits were squashed into one. Then this was converted a few times during the arduino#85 pr time frame as things kept changing and moving around. It has now been updated to the released .3 version. I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines. I later reduced this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite. We defined the additional SPI ports and Wire ports. We defined an initial setup for Analog pins. Have similar hack to GIGA version for pure Analog. Added additional hacks for duplicated pins. That is two of the analog Pins are the exact same pin as some other digital pins... Added some PWM support. Also added WIP: camera support. Co-Authored-By: Mike S <[email protected]>
This is a partial fix for: #68
the spis line was not in the zephyr,user {
section of the ovleray file.
I added it with one entry: spis = <&spi2>;
Updated: the GPIO table, that only the LEDS should be defined with GPIO_ACTIVE_LOW.
EDIT: I did a 2nd commit that added in the other Two Wire(I2C) objects into the wires section, and verified
I could see all three Wire objects on the Arduino PRO breakout board using H7