Yapay zekâ tarafından English dilinden çevrildi ·
Geçen yıl bir laboratuvar için Edison breakout kartıyla uğraştım. Bu kartta /dev/ttyMFD1 dosyasını açmak yetmiyor: 0 ve 1 numaralı pinler bir pin çoklayıcı ve seviye dönüştürücülerden geçiyor; bunlar ayarlanana kadar UART başlığa bağlı değildir, pinler yalnızca düz GPIO’dur. Bu yüzden port hatasız açılıyor ama hiçbir şey okunmuyor.Kolay yol, UART’ı kart numarasıyla açtığınızda mux’ı sizin yerinize ayarlayan mraa kütüphanesini kullanmaktır:
import mraa
u = mraa.Uart(0) # pins 0/1 on the Arduino breakout, sets the mux
u.setBaudRate(115200)
u.setMode(8, mraa.UART_PARITY_NONE, 1)
while True:
if u.dataAvailable(1000):
line = u.readStr(64).strip() # "caps_ok=1823;caps_rej=12"
vals = dict(kv.split("=") for kv in line.split(";"))
# add to the payload the Edison already sends:
payload["caps_ok"] = int(vals["caps_ok"])
payload["caps_rej"] = int(vals["caps_rej"])
Ayrıca kablolamanın çapraz olduğunu kontrol edin: OpenMV TX, Edison’un RX (pin 0) ucuna; OpenMV RX, Edison’un TX (pin 1) ucuna bağlanmalı. Breakout kartında pin 0 RX’tir; yazdığınız şey kablolamayla birebir aynıysa bunları birbiriyle değiştirin.
I fought the Edison breakout for a lab last year. Opening /dev/ttyMFD1 isn’t enough on that board: pins 0 and 1 go through a pin multiplexer and the level shifters, and until those are set up the UART isn’t connected to the header at all, the pins are plain GPIO. That’s why it opens fine and reads nothing.
The easy way is the mraa library, which sets the mux for you when you open the UART by its board number:
import mraa
u = mraa.Uart(0) # pins 0/1 on the Arduino breakout, sets the mux
u.setBaudRate(115200)
u.setMode(8, mraa.UART_PARITY_NONE, 1)
while True:
if u.dataAvailable(1000):
line = u.readStr(64).strip() # "caps_ok=1823;caps_rej=12"
vals = dict(kv.split("=") for kv in line.split(";"))
# add to the payload the Edison already sends:
payload["caps_ok"] = int(vals["caps_ok"])
payload["caps_rej"] = int(vals["caps_rej"])
Also check the wiring is crossed: OpenMV TX to the Edison’s RX (pin 0), OpenMV RX to the Edison’s TX (pin 1). Pin 0 is RX on the breakout, so if what you wrote is exactly how it’s wired, swap them.

