aBUGSworstnightmare wrote:Hi,
started working on my first project using a CM3Lite. I'm now asking myself what is the best - or recommended way - to configure the GPIO.
I need to have peripherals initialised as early as possible, that's why I first thought of having my custom dt-blob.bin file.
You're not initialising the peripherals any sooner, just the GPIO configuration.
aBUGSworstnightmare wrote:In addition, I'm looking for an easy way to configure (enable/disable) some of the peripherals why I think overlays will be suited best for this.
So, here's what I intend to use:
24-bit DPI-Interface (ALT2 mode on GPIO 0 - 27) --> own blob or 24-bit overlay can be used
SD1 (ALT3 mode on GPIO 34 - 39) for WiFi module --> default overlay (sdio-overlay.dts) can't be used since it's configuring the wrong GPIO --> modify this for custom overlay or is there another one doing the same?
both UARTs (UART0 = ALT3 on GPIO31+32, UART1=ALT5 on GPIO40+41) --> is there an overlay for this and is it still UART1 that can be enabled/disabled via raspi-config? Which of them will be used for SSH in case this is enabled?
https://github.com/raspberrypi/firmware ... ADME#L1297
Code: Select all
Name: uart1
Info: Enable uart1 in place of uart0
Load: dtoverlay=uart1,<param>=<val>
Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14)
rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15)
There doesn't appear to be an equivalent overlay for uart0.
I wouldn't recommend mixing and matching using raspi-config and setting up your own overlays - you will end up with strangeness when the raspi-config scripts get confused due to extra parameters.
Neither will get used for SSH. One will get used for the serial console, and that is whichever is registered as serial0 unless you alter /boot/cmdline.txt.
aBUGSworstnightmare wrote:I2C (SDx0 on GPIO28+29) --> is there an overlay?
https://github.com/raspberrypi/firmware ... EADME#L550
Code: Select all
Name: i2c0-bcm2708
Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations
are usable on all platforms.
Load: dtoverlay=i2c0-bcm2708,<param>=<val>
Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*)
scl0_pin GPIO pin for SCL0 (deprecated - use pins_*)
pins_0_1 Use pins 0 and 1 (default)
pins_28_29 Use pins 28 and 29
pins_44_45 Use pins 44 and 45
pins_46_47 Use pins 46 and 47
But i2c-0 isn't available to you if you're using the camera, and otherwise only if you're using
very recent firmware (27 Jan 2017 or later).
You could use i2c-1 on 44&45 ALT2
https://github.com/raspberrypi/firmware ... EADME#L562
Code: Select all
Name: i2c1-bcm2708
Info: Enable the i2c_bcm2708 driver for the i2c1 bus
Load: dtoverlay=i2c1-bcm2708,<param>=<val>
Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2)
scl1_pin GPIO pin for SCL1 (3 or 45 - default 3)
pin_func Alternative pin function (4 (alt0), 6 (alt2) - default 4)
(that overlay could do with being updated to use pins in the same way as i2c0-bcm2708).
aBUGSworstnightmare wrote:In addition some of the remaining GPIO are used for controlling ofter HW (enable signals, reset, PWM, etc). How to deal with them - overlay of device tree blob?
DPI1, CAM0 will be treated similiar to RPi3B initialization, only one USB port will be there.
Camera requires changes to dt-blob.bin - you can't change that.
Where there is an overlay or sensible Linux driver for it then it would be worth using it as the kernel will then reserve the GPIOs for that purpose and avoid conflicts.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.