Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Unable to open "/dev/ser0"

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

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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...

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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