the I2C Bus on my Raspberry Pi 4 Model B is not working altough i2cdetect does detect targets.
I tried to use the Raspberry Pi Sense HAT and the SSD1306 OLED display and the PCA9685 Servo Driver with the I2C Bus. Everything works fine. I don't know why now the I2C Bus doesn`t work. Then I was not sure if one of the devices is defect. The OLED Display sometimes shows "snow". So it could be that there was a corrupted signal.
Then I tested the Raspberry Pi without the Sense HAT. Maybe the Sense HAT could be defect. Nothing helped. Then I unplugged the OLED display without any success. And after that the PCA9685 and plugged in the OLED display. Now the OLED display shows the right result. I tested the three servos which are connected to the PCA9685 with a servo checker and luckily I found out, that they aren't defect. So I connected the PCA9685 again but I can't send a PWM signal to my servos. After that I removed the I2C hub on which the PCA9685 and the OLED display are plugged in to test the Raspberry Pi Sense HAT again. It doesn`t work. After that I tried the Sense HAT on an older Raspberry Pi 3 Model B+ and there I can use it correctly.
So my thought was that there is something wrong with the Raspberry Pi configuration for the I2C Bus. Then I go to the raspi-config and deactivated the I2C Interfacing option, rebooted the Pi and again enabled this option. Nothing helped.
I can't use the PCA9685 and the Servos, and I also can't use the Raspberry Pi Sense HAT and I can't use the OLED display. With i2cdetect I can detect adresses.
So here is what I got:
python imu.py
Traceback (most recent call last):
File "imu.py", line 3, in <module>
sense = SenseHat()
File "/usr/lib/python3/dist-packages/sense_hat/sense_hat.py", line 39, in __init__
raise OSError('Cannot detect %s device' % self.SENSE_HAT_FB_NAME)
OSError: Cannot detect RPi-Sense FB device
It could be any python test program for the Sense HAT. Two days ago. Everything worked... The programs for the servos I could run without any errors but now the servos doesn`t do anything. So they don't get the PWM signal. Now I tested the OLED display program and it works. But instead of showing the text static it is blinking. Maybe this is because the I2C Bus not working correctly.
sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- 5f
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- --
70: 70 -- -- -- -- -- -- --
1c, 3c, 5c, 5f und 6a should be the Sense HAT... 40 the OLED Display and 70 the PCA9685.
dmesg | grep i2c
[ 2.434699] i2c /dev entries driver
cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
i2c-dev
i2c-bcm2708
spi-bcm2835
spi-bcm2708
snd-bcm2835
cat /etc/modprobe.d/raspi-blacklist.conf is empty
sudo i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
In the /boot/config.txt both lines are enabled:
dtparam=i2c1=on
dtparam=i2c_arm=on
I can't say what causes the error and what exactly would be the error. Two days ago everything works but now not. On the PCA9685 I measured the voltage on the pins and they aren't defect.
Also the dtoverlay=rpi-sense is enabled in the /boot/config.txt.
raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT pull=UP
GPIO 1: level=1 fsel=0 func=INPUT pull=UP
GPIO 2: level=1 fsel=4 alt=0 func=SDA1 pull=UP
GPIO 3: level=1 fsel=4 alt=0 func=SCL1 pull=UP
GPIO 4: level=0 fsel=0 func=INPUT pull=UP
GPIO 5: level=0 fsel=0 func=INPUT pull=UP
GPIO 6: level=1 fsel=0 func=INPUT pull=UP
GPIO 7: level=1 fsel=1 func=OUTPUT pull=UP
GPIO 8: level=1 fsel=1 func=OUTPUT pull=UP
GPIO 9: level=0 fsel=4 alt=0 func=SPI0_MISO pull=DOWN
GPIO 10: level=0 fsel=4 alt=0 func=SPI0_MOSI pull=DOWN
GPIO 11: level=0 fsel=4 alt=0 func=SPI0_SCLK pull=DOWN
GPIO 12: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 13: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 14: level=1 fsel=2 alt=5 func=TXD1 pull=NONE
GPIO 15: level=1 fsel=2 alt=5 func=RXD1 pull=UP
GPIO 16: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 17: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 18: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 19: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 20: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 21: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 22: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 23: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 24: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 25: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 26: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 27: level=0 fsel=0 func=INPUT pull=DOWN
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=2 alt=5 func=RGMII_MDIO pull=UP
GPIO 29: level=0 fsel=2 alt=5 func=RGMII_MDC pull=DOWN
GPIO 30: level=0 fsel=7 alt=3 func=CTS0 pull=UP
GPIO 31: level=0 fsel=7 alt=3 func=RTS0 pull=NONE
GPIO 32: level=1 fsel=7 alt=3 func=TXD0 pull=NONE
GPIO 33: level=1 fsel=7 alt=3 func=RXD0 pull=UP
GPIO 34: level=1 fsel=7 alt=3 func=SD1_CLK pull=NONE
GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD pull=UP
GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0 pull=UP
GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1 pull=UP
GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2 pull=UP
GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3 pull=UP
GPIO 40: level=0 fsel=4 alt=0 func=PWM1_0 pull=NONE
GPIO 41: level=0 fsel=4 alt=0 func=PWM1_1 pull=NONE
GPIO 42: level=0 fsel=1 func=OUTPUT pull=UP
GPIO 43: level=1 fsel=0 func=INPUT pull=UP
GPIO 44: level=1 fsel=5 alt=1 func=SDA0 pull=UP
GPIO 45: level=1 fsel=5 alt=1 func=SCL0 pull=UP
BANK2 (GPIO 46 to 53):
GPIO 46: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 47: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 48: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 49: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 50: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 51: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 52: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 53: level=0 fsel=0 func=INPUT pull=DOWN
I'm not sure where I could search the error because I the hardware works on an older Raspberry Pi. Hopefully there is a person who could help me. Thanks in advance.
Question
Short description of problem
The OP's I2C bus works, but only intermittently.
Configuration
The OP is using Rpi4B. He is testing the following I2C devices:
1. Sense HAT
2. SSD1306 OLED display and
3. PCA9685 PWM Controller/Servo Driver, connected to up to 3 servos.
Summary of the OP's test results
In the beginning, I2C bus can detect I2C devices (one by one) without any problem.
After the I2C Hub (Note 1) has been removed and restored, errors begin to appears, all sense HAT, OLED display, PWM controller do not work, or do not work properly.
At this point, i2cdetect -y 1 still works OK.
Possible causes of problem and troubleshooting suggestions
1. The I2C bus might be overloaded.
The I2C bus has a maximum impedance limit, around 400pF. So if you put too many I2C devices on the same bus, total capacitance increases and I/O error 121 begin to appear and performance is no longer stable. I usually find I2C bus not stable when I add more and more I2C device, especially with the same I2C addresses. For example, I can add three or four different I2C devices on the same bus, find no problem, but when I try to add more and more I2C devices of the same type (MCP23017 in my experiment) the system get unstable, I/O Error become frequent. My conclusion is that even I can add the maximum of 8 MCP23017s and can still be detected, but system is very unstable, and usually two MCP23017 is the limit for stable operation.
2. The wiring might be too long
When wiring is too long, capacitance/impedance will sooner or later reach the 400pF limit. I usually start with 30cm, and by trials and errors, extends to some two meters, when problems begin to appear. A quick and dirty solution is to use a level shifter, say TBX0102, and the situation improves. I once tried to use hardware I2C extender and buffer chips but found results not impressive. I also tried to use twisted CAT5 cables, but still cannot go too long.
3. I2C speed too high
For Rpi4B, we can adjust the I2C speed, down to say 10kHz, and up to 500kHz. Lower speed lowers I2C bus impedance, and therefore smaller signal distortion and less errors.
4. PCA9685 PWM controller board too noisy
This PCB board has a space to insert a "big" capacitor, to stabilize the local power supply. I forgot if 100uF is the recommend value, but greedy me usually use 1000uF or more. And I never use the Rpi's 5V power rail to drive the servos/DC motors. I always use an external power supply (6 ~ 7.5V, 3A+). Also, always try to apply the PWM signals to the servos "out of sync", to reduce spikes and glitches which might feed back to the Rpi and causes trouble.
5. Using multiple I2C buses so not to overload on one single bus
For Rpi4B, there are 5 one board I2C buses you can use. So the OP might like to spread the load to say, three buses, especially using a single bus to entertain the possibly trouble making PCA9685 PWM/servo controller.
The penzu lab report below shows how to config Rpi for more that one I2C bus, and an example of using 3 ADXL345's for three separate bus (PCA9685 is briefly described).
Configuring and using Rpi4B's 5 I2C Buses
Appendix A - /boot/config.txt tlfong01 2020mar04
# /boot/config.txt 2020feb0801 tlfong01
# last update 2020mar04hkt1830
# *** Display ***
disable_overscan=1
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
# *** Audio ***
dtparam=audio=on
# *** UART ***
enable_uart=1
# *** I2C ***
# *** Changingspeed***
# dtparam=i2c_arm=on,i2c_arm_baudrate=50000
# dtparam=i2c_arm=on,i2c_arm_baudrate=100000
# dtparam=i2c_arm=on,i2c_arm_baudrate=400000
dtparam=i2c_arm=on,i2c_arm_baudrate=1000000
# *** Configuring two I2 buses ***
dtoverlay=i2c1,pins_2_3 (board pins 3, 5)
dtoverlay=i2c3,pins_4_5 (board pins 7, 29)
# dtoverlay=i2c4,pins_6_7 (board pins 31, 26)
# dtoverlay=i2c5,pins_12_13 (board pins 32, 33)
# dtoverlay=i2c6,pins_22_23 (board pins 15, 16)
# *** SPI ***
dtparam=spi=on
dtoverlay=spi1-3cs
# *** End of config.txt ***
/ to continue, ...
try this in /boot/config.txt
#dtparam=i2c_arm=on
dtoverlay=i2c-gpio,i2c_gpio_sda=2,i2c_gpio_scl=3,i2c_gpio_delay_us=2,bus=1
worked for me (RPi4 Client with Arduino as I2C Server)
100khz Standard I2C 10k pullups
if you check /dev's contents you'll see that there isn't i2c-0 or i2c-1 but there may be an i2c-20 and i2c-21
I tried sudo i2cdetect -y 20 and that returned the expected output albeit incorrect for the i2c devices I had.
weird.
I had the same problems with 4 hats connected on i2c bus, pi4b would only detect 1 device, connected each individually and each device was detected, all different addresses.
I had it set up on a DIN rail with ribbon cables between each board to make it easier to access screw terminals whilst I was building the project, after reading these posts I got rid of the ribbon cables and now all 4 devices detected on i2c and everything works perfectly. Thank you!
Related
I write a tool with eBPF, which will read the specified packet with XDP. I once compile and run it successfully in 5.04 kernel edition. But when I run it in kernel 4.19, it could be compiled, but error in load and verify. The error message is :
372: (07) r0 += 14
373: (07) r7 += 2
374: (bf) r1 = r0
375: (bf) r3 = r7
376: (85) call bpf_probe_read#4
unknown func bpf_probe_read#4
libbpf: -- END LOG --
libbpf: failed to load program 'xdp_parser_func'
libbpf: failed to load object 'kafkaprobe.bpf.o'
I am curious whether kernel 4.19 could run eBPF&XDP program?
I used other BPF helper function in my program without any problem. bpf_probe_read is the only trouble.
I have try to delete the bpf_probe_read_kernel() in program, and it could work. But it's nonsence if I couldn't read the message in packet. So I want to know there is any other way to read packet in eBPF program.
I compiled U-Boot (#v2022.01-rc1) with untouched rpi_4_defconfig. The U-Boot loads into shell successfuly, however
entering this sequence of commands will get stuck on "Starting kernel ...":
setenv serverip 192.168.0.1
setenv ipaddr 192.168.0.10
setenv kernel_comp_addr_r 0x0A000000
setenv kernel_comp_size 7921972
tftp ${kernel_addr_r} kernel8.img
tftp ${fdt_addr_r} bcm2711-rpi-4-b.dtb
booti ${kernel_addr_r} - ${fdt_addr_r} // Gets stuck at Starting kernel...
However, if I replace ${fdt_addr_r} with ${fdt_addr} in booti command it will load the kernel successfully. Like this:
booti ${kernel_addr_r} - ${fdt_addr} // Works fine
What is the difference between ${fdt_addr_r} and ${fdt_addr}? Why doesn't my first approach work? Why does ${fdt_addr} work?
DEBUG INFO:
RPi firmware boot logs:
Read start4.elf bytes 2228768 hnd 0x00000072
Read fixup4.dat bytes 5446 hnd 0x00000067
Firmware: d7f29d96450abfc77cd6cf011af1faf1e03e5e56 Apr 30 2021 13:45:52
0x00c03112 0x00000000 0x000000ff
MEM GPU: 76 ARM: 948 TOTAL: 1024
Starting start4.elf # 0xfec00200 partition 0
PCI reset
+
MESS:00:00:05.184648:0: arasan: arasan_emmc_open
MESS:00:00:05.332928:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:05.335639:0: brfs: File read: 81 bytes
MESS:00:00:05.402894:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:05.421071:0: brfs: File read: 81 bytes
MESS:00:00:05.902232:0: gpioman: gpioman_get_pin_num: pin DISPLAY_DSI_PORT not defined
MESS:00:00:05.909524:0: *** Restart logging
MESS:00:00:05.914477:0: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead
MESS:00:00:05.923831:0: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead
MESS:00:00:05.929762:0: HDMI0: hdmi_pixel_encoding: 300000000
MESS:00:00:05.935229:0: HDMI1: hdmi_pixel_encoding: 300000000
MESS:00:00:05.945421:0: dtb_file 'bcm2711-rpi-4-b.dtb'
MESS:00:00:05.952218:0: brfs: File read: /mfs/sd/bcm2711-rpi-4-b.dtb
MESS:00:00:05.955466:0: Loading 'bcm2711-rpi-4-b.dtb' to 0x100 size 0xc2a9
MESS:00:00:05.974659:0: brfs: File read: 49833 bytes
MESS:00:00:06.039897:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:06.042389:0: brfs: File read: 81 bytes
MESS:00:00:06.047663:0: brfs: File read: /mfs/sd/overlays/disable-bt.dtbo
MESS:00:00:06.067534:0: Loaded overlay 'disable-bt'
MESS:00:00:06.107041:0: brfs: File read: 1073 bytes
MESS:00:00:06.108885:0: Failed to open command line file 'cmdline.txt'
MESS:00:00:07.249713:0: brfs: File read: /mfs/sd/u-boot.bin
MESS:00:00:07.252181:0: Loading 'u-boot.bin' to 0x80000 size 0x8f720
MESS:00:00:07.258265:0: Device tree loaded to 0x2eff3800 (size 0xc743)
MESS:00:00:07.266568:0: uart: Set PL011 baud rate to 103448.300000 Hz
MESS:00:00:07.273628:0: uart: Baud rate change done...
MESS:00:00:07.275688:0: uart: Baud rate change done...
MESS:00:00:07.281220:0: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
U-Boot log:
U-Boot 2022.01-rc1 (Nov 11 2021 - 15:59:50 +0100)
DRAM: 3.9 GiB
RPI 4 Model B (0xc03112)
MMC: mmcnr#7e300000: 1, mmc#7e340000: 0
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial
Out: serial
Err: serial
Net: eth0: ethernet#7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 2
U-boot environment (without entering any commands, or modifying env in any way):
arch=arm
baudrate=115200
board=rpi
board_name=4 Model B
board_rev=0x11
board_rev_scheme=1
board_revision=0xC03112
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_net_usb_start=usb start
boot_pci_enum=pci enum
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc0 mmc1 usb0 pxe dhcp
bootcmd=run distro_bootcmd
bootcmd_dhcp=devtype=dhcp; run boot_net_usb_start; run boot_pci_enum; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; run boot_pci_enum; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=devnum=0; run usb_boot
bootdelay=2
cpu=armv8
dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;config.txt fat 0 1;Image fat 0 1
dhcpuboot=usb start; dhcp u-boot.uimg; bootm
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
ethaddr=dc:a6:32:5f:91:f4
fdt_addr=2eff3800
fdt_addr_r=0x02600000
fdt_high=ffffffffffffffff
fdtcontroladdr=3af44630
fdtfile=broadcom/bcm2711-rpi-4-b.dtb
initrd_high=ffffffffffffffff
kernel_addr_r=0x00080000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x1000000
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
preboot=pci enum; usb start;
pxefile_addr_r=0x02500000
ramdisk_addr_r=0x02700000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x02400000
serial#=100000009b911a03
soc=bcm283x
stderr=serial,vidconsole
stdin=serial,usbkbd
stdout=serial,vidconsole
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
usbethaddr=dc:a6:32:5f:91:f4
vendor=raspberrypi
Environment size: 4113/16380 bytes
U-boot process of entering commands and booting the kernel:
U-Boot> setenv serverip 192.168.0.1
U-Boot> setenv ipaddr 192.168.0.10
U-Boot> setenv kernel_comp_addr_r 0x0A000000
U-Boot> setenv kernel_comp_size 7921972
U-Boot> tftp ${kernel_addr_r} kernel8.img
Using ethernet#7d580000 device
TFTP from server 192.168.0.1; our IP address is 192.168.0.10
Filename 'kernel8.img'.
Load address: 0x80000
Loading: *################################################## 7.6 MiB
13.9 MiB/s
done
Bytes transferred = 7921972 (78e134 hex)
U-Boot> tftp ${fdt_addr_r} bcm2711-rpi-4-b.dtb
Using ethernet#7d580000 device
TFTP from server 192.168.0.1; our IP address is 192.168.0.10
Filename 'bcm2711-rpi-4-b.dtb'.
Load address: 0x2600000
Loading: *################################################## 48.7 KiB
5.3 MiB/s
done
Bytes transferred = 49833 (c2a9 hex)
U-Boot> booti ${kernel_addr_r} - ${fdt_addr_r}
Uncompressing Kernel Image
Moving Image from 0x80000 to 0x200000, end=17f0000
## Flattened Device Tree blob at 02600000
Booting using the fdt blob at 0x2600000
Using Device Tree in place at 0000000002600000, end 000000000260f2a8
Starting kernel ... // <------ !!!! stuck here forever
Regarding ${fdt_addr} and ${fdt_addr_r}:
The u-boot rpi_4_defconfig configures CONFIG_OF_BOARD. By this option u-boot does not use its own device tree, but it receives the device tree which is provided by the eeprom bootloader of the Raspberry Pi 4. The RPi bootloader already prepares the device tree depending on the options in the file config.txt of the boot partition, including dt-overlays and including bootargs specified in cmdline.txt.
So the device tree located at address ${fdt_addr} is the device tree prepared by the Raspberry Pi bootloader. This might be the reason why booting using ${fdt_addr} works. As a consequence, you don't have to necessarily prepare and load a device tree on your own on the Raspberry Pi. You could just reuse ${fdt_addr} in the u-boot booti command as it is already loaded.
If you choose to load your own device tree, compare its contents with the configuration in config.txt (especially the dtoverlay=..). Also check cmdline.txt for bootargs. In your u-boot command list you did not set any bootargs with setenv bootargs ....
As mentioned by sawdust you could use setenv bootargs 'earlycon=uart8250,mmio32,0xfe215040 console=serial0,115200 ...' for getting debug infos on the miniuart serial line.
I am currently using an SRF-10 sensor connected to an esp32. It's being powered by 5V and I am using a level converter to bring down the voltage to 3.3V to be able to use it on the esp32. Both the SCL and SDA have a 1.8K pull up resistor as recommended on the datasheet.
I have written the following script to try to get a read from the sensor. I am not entirely sure if it is correct but soon as it reaches line 16 I get an error saying [Errno 19] ENODEV. Eveything I could find suggests that the i2c connection isn't working properly but when I run i2c.scan() it returns the sensor address so I am guessing connections arenĀ“t the problem.
My script is as follows:
from machine import I2C, Pin
import time
byte = bytearray(4)
#Distance units
unit_in = 0x50
unit_cm = 0x51
unit_us = 0x52
i2c = I2C(scl=Pin(21), sda=Pin(22))
address = i2c.scan()[0]
print(address)
#Sensor range
range_mm = 11008 // 43 - 1
i2c.writeto_mem(range_mm, address, bytearray(2)) #line 16
#Begin reading
i2c.writeto_mem(unit_cm, address, bytearray(0))
#Reading after measurement
data = i2c.readfrom_mem(4, address, 0)
print(data)
This is the output:
112
Traceback (most recent call last):
File "main.py", line 22, in <module>
OSError: [Errno 19] ENODEV
MicroPython v1.12 on 2019-12-20; ESP32 module with ESP32
Type "help()" for more information.
What could I be doing wrong?
The proper use of i2c.writeto_mem requires the following order of arguments:
writeto_mem(addr, memaddr, buf, *, addrsize=8)
Therefore, try to use in line 16:
i2c.writeto_mem(address, range_mm, bytearray(2)) #line 16
Reference: class I2C
I wish you a good day
I'm trying U-Boot on RPi and in short - I'm stuck that when I put any dtoverlay in config.txt, after turning on RPi it's just hangs on rainbow RPi splash screen
I have created rootfs using buildroot 2020.02.1 and U-Boot 2020.01
buildroot config for U-Boot
When I have just this in config.txt:
[pi0w]
kernel=uboot_rpi_0_w.bin
[all]
device_tree_address=0x03000000
hdmi_drive=1
hdmi_force_hotplug=1
dtparam=spi=on
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=watchdog=on
and boot.scr I create using this:
setenv fdt_addr_r 0x03000000
setenv kernel_addr_r 0x01000000
fdt addr ${fdt_addr_r}
fdt get value bootargs /chosen bootargs
load mmc 0:1 ${kernel_addr_r} zImage
bootz ${kernel_addr_r} - ${fdt_addr_r}
so RPi boots fine. But once I add to config.txt for example "dtoverlay = miniuart-bt" then nothing - only rainbow. I need to add this 3 dtbo: "miniuart-bt, vc4-fkms-v3d, ads7846"
My original config.txt (without U-Boot):
boot_delay=1
kernel=zImage
hdmi_drive=1
hdmi_force_hotplug=1
avoid_warnings=1
disable_overscan=1
disable_splash=1
force_turbo=1
gpu_mem_256=128
gpu_mem_512=128
gpu_mem_1024=128
dtparam=spi=on
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=watchdog=on
dtoverlay=miniuart-bt
dtoverlay=vc4-fkms-v3d
# Display configuration [WaveShare 4inch HDMI LCD]
dtoverlay=ads7846
dtparam=penirq=25
dtparam=xomhs=60
dtparam=xmin=300
dtparam=xmax=3750
dtparam=ymin=150
dtparam=ymax=3800
dtparam=rotate=0
dtparam=swapxy=0
hdmi_force_mode=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt=480 800 60 6 0 0 0
Thank you in advance for your help
You need to comment the dtoverlay=vc4-fkms-v3d line when you're using dtoverlay=ads7846 at the same time.
I am having a hard time getting a response when accessing the DLP2000 evm from my Rpi3, "Raspberry Pi". I have used I2cset and I2cget to interact with the EVM.
I2cdetect identifies the 0x1b for the 2607 and 0x57 for the EEprom. Reading from any of the preset registers returns 00 in all cases.
Have tried to activate any of the test images, using reg 0x11 for test pattern generation, with no result, my commands were:
i2cset -y 1 0x1b 0x11 0x3 i # This should show a green screen
No change!!1
Has anybody been successful with using an Rpi3 with the eval module?