Closed xlla closed 4 years ago
I found the reason. in function mraa_gpio_read_dir, it will check line->flags with those macro
#define GPIOLINE_FLAG_KERNEL (1UL << 0) /* Line used by the kernel */ #define GPIOLINE_FLAG_IS_OUT (1UL << 1) #define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2) #define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3) #define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4)
but in mraa_gpio_chardev_dir function, it had prepare line tristate, set line->flag with those macro
/* Linerequest flags */ #define GPIOHANDLE_REQUEST_INPUT (1UL << 0) #define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1) #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2) #define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3) #define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4)
then mraa will think this line was used by kernel, skip some code to set tristate high. after comment check logic , it works! I can comfirm uart with mraa lib was fine.
I compiled a mraa uart test progrom, by comment all uart mux/bias statements, prepare uart2w in acpi tables.
I connect D0/D1 to another Arduino mega 2560 board's D16/D17, and run a SerialPassthrough sketch, it monitor data from D16/D17(uart2) then write to usb(uart) and vice versa.
But I can't read any char in Arduino's monitor. can't read any char in Edison board too.
here is gpio info.
it seems no one used GP130/GP131, mraa lib just open /dev/ttyS1 and write/read data.