mraa icon indicating copy to clipboard operation
mraa copied to clipboard

issue with uart devpath in tag 2.0.0

Open vsivanagulu opened this issue 6 years ago • 4 comments

I ma trying to add uart to my custom am335x based board . I have issues with devpath in uart initialization

mraa_result_t mraa_cosmic_uart_init_pre(int index) { char devpath[MAX_SIZE]; snprintf(devpath,MAX_SIZE,"/dev/ttyO%u",index); if (!mraa_file_exist(devpath)) { syslog(LOG_ERR, "uart: Device not initialized"); }else { plat->uart_dev[index].device_path = devpath; return MRAA_SUCCESS; } return MRAA_ERROR_INVALID_PARAMETER; } In above I have printed devpath values

else { printf("path=%s",devpath); plat->uart_dev[index].device_path = devpath; printf("devpathaftre=%s",plat->uart_dev[index].device_path); return MRAA_SUCCESS; } output: path=/dev/ttyO1 Failed to initialize UART devpathafter=/dev/ttyO1

if I add like below then UART is working fine 'plat->uart_dev[index].device_path = "/dev/ttyO1";'

Why devpath is not working even the string is correct. Kindly guide me to resolve the issue. I have taken phyboard-wega reference. same code for wega board is working.

vsivanagulu avatar Feb 22 '19 09:02 vsivanagulu

Maybe check formatting/string termination on your written devpath? Just like you pointed out, this works with a constant literal so I doubt it's a mraa issue.

Propanu avatar Feb 22 '19 15:02 Propanu

@vsivanagulu, please post syslog contents around the time of your program run. The error message you post is not from the code you posted, but from UART example code, right? Posting full code you've changed may be helpful as well, but we can start with syslog.

alext-mkrs avatar Feb 23 '19 19:02 alext-mkrs

@vsivanagulu, is this still actual?

alext-mkrs avatar May 05 '19 13:05 alext-mkrs

@alext-mkrs ,i have stoped this currently for some other important work. i will do it soon.

vsivanagulu avatar May 22 '19 04:05 vsivanagulu