簡體   English   中英

BeagleBone Black:如何激活 UART 4 或 5 以啟用 RS-485 通信

[英]BeagleBone Black: how to activate UART 4 or 5 to enable RS-485 communication

我想使用 comms cape 2 為我的 BBB 啟用 RS-485CANbus 通信。

我曾經通過 /boot/uEnv.txt 通過用 EEProm 覆蓋來設置我的 Beaglebone black,如下所示:

###Overide capes with eeprom
uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo

然后我使用 ttyS4 進行 RS-485 通信。

雖然它曾經在某些 BBB 上有效,但在許多其他 BBB 上已不再適用,並且引發了許多問題:

  1. 如果我這樣做,CANbus 就會停止工作——可能會弄亂 CANbus 的 UART;
  2. 如果我不使用 CANbus,這個設置似乎不再適用於 RS-485 本身——我猜有些變化取決於安裝的 linux 版本。

長話短說,我想找到一種現代方法來 1) 設置 RS-485 通信和 2) 設置 CANbus 通信,以便它們同時工作。

而且,可能,我如何獨立於我自己的軟件測試 RS-485 通信工作?

我在 Web 上找到的內容:

這里的官方 cape comms 文檔https://github.com/beagleboard/capes/tree/master/beaglebone/Comms告訴我們如何設置如下:

For the RS485, you just need
config-pin p9.11 uart
config-pin p9.13 uart 
...and then use /dev/ttyS4

For the CAN, you just need
config-pin p9.24 can
config-pin p9.26 can

但就我而言,設置config-pin p9.11 uart會導致以下錯誤:

ERROR: open() for /sys/devices/platform/ocp/ocp:P9_11_pinmux/state failed, No such file or directory

這個 SO beaglebone black: no slots while enable uart告訴如何設置 UART5。 他們說要禁用視頻,我做到了。 並:

config-pin P8_37 uart
config-pin P8_38 uart

這對我有效,我的意思是沒有產生錯誤。 然后我在自己的軟件中使用ttS5 ,但我在 RS-485 上看不到任何東西。

這時候我有點疑惑:比如我要不要覆蓋EEPROM? 我應該堅持禁用視頻、聲音等嗎?為什么 UART4 的配置引腳不起作用? UART 5 是否對應 ttyS5? 以及如何確保我使用的 ttySX 真的能與 RS-485 通信一起工作?

提前致謝。

附錄:我當前的/boot/uEnv.txt

#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.19.94-ti-r42
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U$
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
#uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_qual$

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_qua$

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

這是我的 /boot/uEnv.txt 文件:


#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.19.94-ti-r71
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
uboot_overlay_addr0=BONE-SPI1_0.dtbo
uboot_overlay_addr1=BONE-SPI0_0.dtbo
#uboot_overlay_addr2=<file2>.dtbo
#uboot_overlay_addr3=<file3>.dtbo

我沒有在我的 uboot-overlays 部分應用 /lib/firmware 部分。

這是ls -l /dev/spidev*


crw------- 1 root root 153, 0 Feb 10 00:39 /dev/spidev1.0
crw------- 1 root root 153, 1 Feb 10 00:39 /dev/spidev2.0

我認為不是 root 對我來說可能是個問題。

無論如何......我認為這些天在源代碼中使用了符號鏈接,並且還有一個最新的回購協議。 來自 BeagleBoard.org 研究員/gals,他們幫助將他們的 .dts 文件生成為 .dtb/o 文件。 它對我很有用,因為我可以更改內容或查看 beagleboard.org 上的人員正在使用 DT 做什么。

最后,我為解決此問題所做的工作是:

  • 將 ttyS4 用於 RS-485;
  • 使用 can1 進行 CANbus 通信。

那么/boot/uEnv.txt就很簡單了,就是不設置任何UART,保持默認即可。 這里是:

$ cat /boot/uEnv.txt

#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.19.94-ti-r71
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
#uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
#uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
#uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo


###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=0
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM