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


Erwan Gouriou
 

Hi Dhamu,

I saw the task you entered in Jira afterwards and now better understand your question.
Indeed, you might need additional settings to get these ports working:
One point is that you should activate them in dts files and nucleo_l476rg_defconfig.
Also, please check that GPIO ports are activated according to your pinmuxing.
I'll have a check and get back to you.

A sample test was present some time ago, but it has been moved to tests section and now is more adapted to extensive testing rather than simple (re-)use.
Re-instanciating a basic serial sample might indeed be a good idea.

Regards
Erwan


On 9 May 2017 at 15:12, Dhamodharan Krishnan <dhamukrish@...> wrote:
Thanks Erwan for your reply.

Basically, I was able to use UART2 without any issue. But I have GPS and GSM modules which are serial device and hence need UART1 and 3 apart from UART2 for fetching and processing the data.

Would be very helpful if any example or advise much appreciated.

Regards
Dhamu


On 09-May-2017, at 12:48 PM, Erwan Gouriou <erwan.gouriou@...> wrote:

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@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel




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