Closed MrPanc0 closed 1 year ago
Hi, please let us know if you are stuck and have questions.
Hi, please let us know if you are stuck and have questions.
Yeah, unfortunately, I'm horribly stuck. Somehow I can't verify the pin positions to add for the chip.
sudo gpiodetect
and sudo gpioinfo
they don't do anything. I'm not wise from the RK3568B2 data sheet.
Ok, so here's the pinout for the connector: https://wiki.odroid.com/odroid-m1/hardware/expansion_connectors. Likely the Export No value in the first table corresponds to the ones that libgpiod uses. So, some questions:
Which OS are you using?
What is the full output of the gpiodetect
and gpioinfo
?
That will help with figuring out what needs to happen.
As a starting point, I would take https://github.com/adafruit/Adafruit_Blinka/blob/main/src/adafruit_blinka/microcontroller/rockchip/rk3399/pin.py
Then looking at the pinout link for the connector, I would use the J1 - 2x20 PINS table. So for instance, pin 3 says GPIO3B.6 (#110)
. In the chip file I would add it as GPIO3_B6 = Pin(110)
to keep the notation consistent. Once you have that all set up, you could just test.
Which OS are you using?
Ubuntu 22.04
What is the full output of the gpiodetect and gpioinfo?
command not found
.......the connector:
to map the pins for https://github.com/adafruit/Adafruit_Blinka/pull/624/commits/3b51fbd50535eb8bea56e5a0ccb676d418e625d6 I used sudo gpio readall -a
and https://wiki.odroid.com/odroid-m1/hardware/expansion_connectors
What is the full output of the gpiodetect and gpioinfo?
command not found
It sounds like it's not installed then. Check out this section of the guide: https://learn.adafruit.com/adding-a-single-board-computer-to-blinka/software-setup#installing-libgpiod-as-a-package-3058813
Also, I just checked your changes so far and the overall structure of this is starting to look good.
here are the outputs, I tried to turn on the LED on GPIO3D.7 (pin 10) without success
sudo gpioset gpiochip0 10=1
sudo gpioset gpiochip1 10=1
sudo gpioset gpiochip2 10=1
sudo gpioset gpiochip3 10=1
sudo gpioset gpiochip4 10=1
~$ sudo gpioset gpiochip1 0=0 ~$ sudo gpioset gpiochip1 1=1 ~$ sudo gpioset gpiochip1 1=0 ~$ sudo gpioset gpiochip1 2=1
sudo gpiodetect
gpiochip0 [gpio0] (32 lines) gpiochip1 [gpio1] (32 lines) gpiochip2 [gpio2] (32 lines) gpiochip3 [gpio3] (32 lines) gpiochip4 [gpio4] (32 lines)
sudo gpioinfo
gpiochip0 - 32 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused output active-high
line 3: unnamed "interrupt" input active-high [used]
line 4: unnamed "cd" input active-low [used]
line 5: unnamed "vcc5v0-usb-otg" output active-high [used]
line 6: unnamed "vcc5v0-usb-host" output active-high [used]
line 7: unnamed unused input active-high
.....
line 15: unnamed "blue:heartbeat" output active-high [used]
line 16: unnamed unused input active-high
....
line 21: unnamed unused input active-high
line 22: unnamed "red:power" output active-low [used]
line 23: unnamed unused input active-high
...
gpiochip1 - 32 lines:
line 0: unnamed unused input active-high
.....
gpiochip2 - 32 lines:
line 0: unnamed unused input active-high
.....
line 29: unnamed unused input active-high
line 30: unnamed "reset" output active-high [used]
line 31: unnamed unused input active-high
gpiochip3 - 32 lines:
line 0: unnamed unused input active-high
......
line 15: unnamed "PHY reset" output active-low [used]
line 16: unnamed unused input active-high
....
gpiochip4 - 32 lines:
line 0: unnamed unused input active-high
....
line 6: unnamed unused input active-high
line 7: unnamed "gpio-regulator" output active-high [used]
line 8: unnamed unused input active-high
.......
Ok, that's more helpful. Now that we know there are 32 GPIO per chip, the format is probably pin((chipID, gpioID))
rather than pin(gpioID)
which uses 0 for the chipID if it's not a tuple. So for GPIO3D.7, maybe try GPIO3D_7 = pin((3, 31))
instead. I got those numbers by figuring 3 full banks of 32 plus pin 31 on bank 3 or (3 * 32) + 31 = 127. It may be completely different, but it's a place to start.
Another trick you might consider trying is to use the blink script to flash a pin you think might be right and then probing on the GPIOs. We'll keep working on this together and if I learn something new I can add it to the guide.
Also, once you match up the first pin, the rest tend to be in some order that typically makes sense. Also, maybe look at some of the PRs @hhk7734 has submitted, who has added most of the Odroid boards.
cipher cracked :D
32/4 =8 -- (for A to D) GPIO3D.7 -- GPIO chip 3 pin (D7=3*8+7) 31 GPIO0B.4 -- chip 0 pin 12
pin 7 - gpioset gpiochip0 14 pin 16 - gpioset gpiochip3 22 pin 12 - gpioset gpiochip3 24 pin 10 - gpioset gpiochip3 31 pin 8 - gpioset gpiochip3 30 works thank you so much
Excellent!
Now I see that for the chip rk3328 the chips are staggered as for rk3568b2
Should I also add the other pins even if they don't lead to the GPIO?
You can get rid of most of the errors by capitalizing pin
to Pin
. You'll also want to make sure the SPDX is added to the top of your files (see other similar files). The just run pre-commit and it should fix the trailing whitespaces.
Should I also add the other pins even if they don't lead to the GPIO?
It's up to you, but I probably wouldn't bother. They can always be added if somebody else has a board that uses the same microcontroller.
Very close. It looks like these files still need the SPDX header:
Also, running pre-commit should reformat the files and fix the other issues and then you can push the reformatting.
Also, running pre-commit should reformat the files and fix the other issues and then you can push the reformatting. Could you please tell me how can i run reformatting?
Hi, just install pre-commit and run it. See https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code
It should reform your code and then you can push the changed files. I attempted to do it for you, but it looks like the "Allow edits by maintainers" option probably was deselected when you created this.
I tried it but it won't run pre-commit maybe it's because I'm trying to run it in VSCode ... don't know.
I tried it but it won't run pre-commit maybe it's because I'm trying to run it in VSCode ... don't know.
You need to run pre-commit from the command line in the project folder. Once you run it, you can use VSCode to push the commits.
I'm not sure why my first attempt didn't work, but I was able to run pre-commit and push the updated files this time.
Ok, now it's failing because the board hasn't been added to Adafruit_Python_PlatformDetect. See https://github.com/adafruit/Adafruit_Python_PlatformDetect/blob/main/adafruit_platformdetect/constants/boards.py#L122-L127.
The good news is that detecting the board is the easy part and something you probably already have working. You'll just need to submit a separate Pull Request for that and once it's merged in, we can re-run the tests here and it should be all good.
Hi, I would like to ask for a review of my attempt to add an Odroid M1 board.