Re: Help required on reading UART device and print on console


Erwan Gouriou
 

Hi Digidhamu,


If you're trying to use default UART (through ST link USB port) on nucleo_l476rg, you should use UART_2.

Erwan






On 6 May 2017 at 09:53, Dhamodharan Krishnan <dhamukrish@...> wrote:
Hi,

I am a day old since I started in Zephyr and from Arduino background. Could you please help with an example how to read from UART ports which are from 
https://www.zephyrproject.org/doc/boards/arm/nucleo_l476rg/doc/nucleol476rg.html (Blinky and Hello World example are working fine).

Here is the code I have tried but failed.

#include <zephyr.h>
#include <misc/printk.h>
#include <uart.h>

int main(void) {

struct device *uartGPS;
uartGPS = device_get_binding(UART_1);

while (1) {
unsigned char* msg;
uart_poll_in(uartGPS, msg);

printk("%s", msg);
}
}

Regards
digidhamu


_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


Join devel@lists.zephyrproject.org to automatically receive all group messages.