Forum Discussion
UART Help
Was doing well in evaluating the IDE/HAL until now. Hit a brick wall going 100mph. I need some pointers on how to read characters from the UART. I tried the example in the Processor Ref handbook, but it won't link. Cant find fopen, fclose, fgetc even though stdio.h is included. Also tried the altera_alt_avalon_uart_read function, but don't understand how to init the alt_fd pointer. I am not a UNIX programmer and this layer of abstraction is confusing to me. Couldn't find any examples. Any help would be great!
Rick15 Replies
- Altera_Forum
Honored Contributor
Including stdio, and something else (I forget) should be all that's needed.
But if printf was working then you probably have what you need. Was the link error anything useful or the normal nonsence that I usually get from visual studio? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif - Altera_Forum
Honored Contributor
I also thought that the scanf would work because the printf did. The error was the standard unresolved external type of error. In another words, it couldn't find code for the scanf. It was the same error generated when I tried the fopen/fclose/getc.
Rick - Altera_Forum
Honored Contributor
Sorry, I'm out of ideas
Are you trying to use scanf for debug or will there be input in the final design? Also what core and debug module (if any) has been added to the system? (drawing at straws, just like you are probably). Good-luck and hopefully someone else can be of more help. - Altera_Forum
Honored Contributor
Can you post the linker error you get please.
- Altera_Forum
Honored Contributor
In fact can you post the linker error you get with the small C Library selected, and then the error when you don't have the small library selected.