Skip to content
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

Add pin overrides to overlays in order to enable norns-shield #40

Merged
merged 2 commits into from Oct 7, 2019

Conversation

@ngwese
Copy link
Member

@ngwese ngwese commented Sep 17, 2019

Note that in order to override overlay parameters via config.txt, the parameter specification must come after the overlay is included. Note that this change hasn't been tested on norns hardware proper but in theory it should be a no-op since the default values are for the norns hardware.

The relevant sections of the config.txt for the shield looks something like this:

...
# Display
# Connected using SPI
dtparam=spi=on
dtoverlay=ssd1322-spi
dtparam=dc-pin=7                                    # <<== new
dtparam=rotate=180                                 # <<== new

# Buttons and encoders
dtoverlay=norns-buttons-encoders
dtparam=e1_pin_a=4                                # <<== new from here to the bottom
dtparam=e1_pin_b=27
dtparam=e2_pin_a=24
dtparam=e2_pin_b=23
dtparam=e3_pin_a=12
dtparam=e3_pin_b=25
dtparam=b1_pin=22
dtparam=b2_pin=26
dtparam=b3_pin=5
@ngwese ngwese requested review from simonvanderveldt and tehn Sep 17, 2019
@tehn
tehn approved these changes Sep 17, 2019
Copy link
Member

@tehn tehn left a comment

wow this syntax is confusing. nice job figuring it out!

@ngwese
Copy link
Member Author

@ngwese ngwese commented Sep 17, 2019

Yeah - the syntax is a nightmare. The __override__ parameter definition is basically a set of specifications which describe for a given override parameter which (of potentially many) fields in the device tree need to be overwritten with the value but for compound values in the tree like:

      gpios = <&gpio 36 1>, <&gpio 37 1>;

...the override spec includes the byte offset of the value that has to change. The above device value for gpios basically sets gpios to 6 x 32bit numbers. To change the 37 the override offset is 16 since (in bytes) the offsets for each value are:

 0:    &gpio
 4:    63
 8:    1
12:    &gpio
16:    37
20:    1

@simonvanderveldt - any comments? If not I'll merge this.

@simonvanderveldt
Copy link
Member

@simonvanderveldt simonvanderveldt commented Sep 18, 2019

Nice! If it's OK I'd like to test this on norns and on rpi with the norns hat before merging.
I should be able to do that tomorrow evening.

@simonvanderveldt
Copy link
Member

@simonvanderveldt simonvanderveldt commented Sep 22, 2019

I don't know if it's this PR of #41 but the display doesn't work for me on norns with both of these changes combined (I merged both of them in a temp branch and built a buildroot image using that branch).
I get the following in the kernel log:

# dmesg | grep -i fb
[    0.000000] Kernel command line: bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 smsc95xx.macaddr=... vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  console=ttyAMA0,115200 consoleblank=0 fbcon=map:1 fsck.repair=yes quiet root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
[    0.936626] fb_ssd1322 spi0.0: Error applying setting, reverse things back
[    0.943508] fb_ssd1322: probe of spi0.0 failed with error -22

I'll do a separate build for only the changes in this PR asap and report back.

@ngwese
Copy link
Member Author

@ngwese ngwese commented Sep 23, 2019

for the buildroot image generated for norns hardware what did the config.txt file look like?

@simonvanderveldt
Copy link
Member

@simonvanderveldt simonvanderveldt commented Sep 24, 2019

@ngwese no changes from what's currently in master.

@ngwese
Copy link
Member Author

@ngwese ngwese commented Sep 25, 2019

okay. good to know. I’m tempted to do a non-buildroot build; straight kernel build, and test that on top of the existing norns image in order to eliminate buildroot specific changes I might have made

@tehn
Copy link
Member

@tehn tehn commented Sep 25, 2019

i think having the normal raspbian image available would additionally be a good thing, so testing the kernel there would right away make that a secondary bonus

@ngwese
Copy link
Member Author

@ngwese ngwese commented Sep 26, 2019

Here is a straight kernel build of the "standard" 4.14.52 norns kernel which we currently ship that includes both the new overlays w/ overrides and the screen rotation change:

https://drive.google.com/open?id=1nDQR6y6kBX35JSBHHqtYP9tcJc77B-Zp

I have confirmed that this works just find on norns hardware running the standard non-buildroot images. Here is the similar output from dmesg on my norns using this build:

% dmesg | grep -i fb
[    0.000000] Kernel command line: bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:11:2A:10 vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  root=/dev/mmcblk0p2 rootfstype=ext4 rootwait console=ttyAMA0,115200 consoleblank=0 fbcon=map:1 fsck.repair=yes quiet
[    0.909670] fbtft_of_value: buswidth = 8
[    0.909675] fbtft_of_value: debug = 3
[    0.909678] fbtft_of_value: rotate = 0
[    0.909681] fbtft_of_value: fps = 20
[    0.909707] fb_ssd1322 spi0.0: fbtft_gamma_parse_str() str=
[    0.909711] fb_ssd1322 spi0.0: 1 1 1 1 1 2 2 3 3 4 4 5 5 6 6
[    0.909747] fb_ssd1322 spi0.0: fbtft_request_one_gpio: 'reset-gpios' = GPIO6
[    0.909757] fb_ssd1322 spi0.0: fbtft_request_one_gpio: 'dc-gpios' = GPIO5
[    0.909783] fb_ssd1322 spi0.0: fbtft_verify_gpios()
[    0.909786] fb_ssd1322 spi0.0: init_display()
[    0.909790] fb_ssd1322 spi0.0: fbtft_reset()
[    1.046695] fb_ssd1322 spi0.0: Display update: 3593 kB/s, fps=0
[    1.046699] fb_ssd1322 spi0.0: set_gamma()
[    1.046827] graphics fb0: fb_ssd1322 frame buffer, 128x64, 16 KiB video memory, 8 KiB buffer memory, fps=20, spi0.0 at 16 MHz

@simonvanderveldt I'm inclined to think there is something off in the buildroot setup have - at least as far as producing a norns image.

The changes are working fine for me both my rpi4 buildroot branch with a 4.19.y kernel and the norns shield as well as on norns hardware with the 4.14.y (with the non-buildroot image).

@simonvanderveldt
Copy link
Member

@simonvanderveldt simonvanderveldt commented Sep 26, 2019

I haven't made any other changes apart from switching the kernel sources compared to current master of the buildroot norns-image, which AFAIK is working correctly, but I'll do a build from that just to be sure.

@simonvanderveldt
Copy link
Member

@simonvanderveldt simonvanderveldt commented Sep 29, 2019

Build for this branch seems to work, so it's probably #41 that breaks the display. Going to test that next.
Could of course also be the combination of both branches.

@simonvanderveldt
Copy link
Member

@simonvanderveldt simonvanderveldt commented Sep 29, 2019

Just built 3 buildroot images for norns using the changes in this PR and in #41 and a combination of both changes. All work fine on norns. Not sure why the image with both these changes didn't work before.

Also built in image for rpi2 but that's not showing anything on the display. Will need to investigate some more why.

Copy link
Member

@simonvanderveldt simonvanderveldt left a comment

Validated together with #41 that norns still works as before and that we can now configure the pins and rotation to make the norns shield work correctly (using the code from simonvanderveldt/norns-image#18) :)

@simonvanderveldt simonvanderveldt merged commit ad20948 into norns-4.14.y Oct 7, 2019
1 check passed
1 check passed
ci/circleci: build Your tests passed on CircleCI!
Details
@simonvanderveldt simonvanderveldt deleted the overlay-overrides branch Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants