Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

Unable to open "/dev/ser0"

Altera_Forum
Honored Contributor II
1,084 Views

I have a sopc design that contains a jtag uart and an avalon uart, while porting a debug console to the platform, it needs to directly talk to the hardware rather than to the tty, otherwise input such as up/down arrow will be interpreted differently as intended. 

 

I managed to make it work with the jtag uart by enabling the option "CYGPKG_IO_SERIAL_DEVICES" and open /dev/ser4. However, while trying to put the samething on to the uart port, i'm not able to open "/dev/ser0", cyg_io_lookup shows that there's no such device, but the default printf does go to the uart and works fine. 

 

Can anyone tell me how to open the uart hardware device from the application? 

 

Thanks & Regards
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
409 Views

There is a special setting for the system console. The UART (either serial uart or jtag uart) that is selected as the system console is initialized at the beginning of the kernel init, and uses a special mode of the driver. Once a component has been opened that way, it can't be opened again through the /dev/ path and can only be used through the stdin/stdout descriptors. 

I don't have an eCos installation right here, but if I remember correctly you can change the component used for the system console somewhere in the NiosII parameters in the eCos configuration.
0 Kudos
Altera_Forum
Honored Contributor II
409 Views

Hi, thanks for your reply, I'm quite new to ecos and I haven't found this option. Do you remember the name or part of the name for that option? I have been playing around with all the serial/terminal related option and haven't been able to open that device. Or, where is the kernel initialization file located? Trying to dive into the kernel source code...

0 Kudos
Altera_Forum
Honored Contributor II
409 Views

If you use the eCos configuration tool, it is in eCos HAL > Nios2 architecture > Diagnostic console device 

The parameter name is CYGHWR_HAL_NIOS2_VV_CONSOLE_DEV
0 Kudos
Altera_Forum
Honored Contributor II
409 Views

Thank you so much! I'll try it out.

0 Kudos
Reply