<div dir="ltr"><div>Sorry for asking again, but I think I can now elaborate better my issues.<br></div><div><br></div><div>I've been trying to make the ERC32 read the serial port. First I tried to use C basic functions such as getchar and gets, and they worked (like a read function in blocking mode). </div>However I want to use read and write functions. The write function worked but  the read function didn't work and I guess that there are configuration issues. I have the source code of the rdbmon monitor used in the board. I saw that it uses the write function to the terminal (Serial A) as something write(1,&char_var,1) and uses the read and write function for the debugging channel (Serial B) as something as write(3,&char_var,1) and read (3,&char_var,1). So the file descriptor 1 is for terminal and the 3 is for the debugging channel. I'm interested in communication through the terminal, so I used the write functios as write(1,&char_var,1) and it worked.  I tried the same for the read function but no success, ir returns <br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>ERRNO: 9 = Bad file number. <br></div></blockquote><div>I know that in linux for example, I can have a blocking read function or a non-blocking one using an assynchronous file descriptor and using a signal (interrupt-like) to get when<br></div><div>there are available bytes in the UART buffer. I tried to open a file descriptor with something like</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div> fd=open("/dev/console_%c", O_RDWR | O_NOCTTY | O_NDELAY)  </div></blockquote><div> as I saw in RTEMS Uart loopback example. However it returns an error ( I don't remember exactly now because I don't have access to the lab at the moment). I suspect that rdbmon opens<br></div>the terminal first to post the board initial message and when I try to open, it blocks a second instance. The problem that as I haven't choose the opening mode I can't configure it<br>termios-like properly. <br><br>Another issue:<br>I have a sample code here with  an isr routine, the rtems_interrupt_catch function is called in the Init function and it is associed with the ERC32 UART A Data readyTransmitter ready trap. I noticed that isr is executing whether there is data to send or receive, but I want it to  work just when there is data to receive. If something is printed before it executes indefinitely and I can't properly use a read function in this case. It is worth to say that there is an ERC_Unmask command for the UART A interrupt in the Init function.<br><br>Sorry for the long text, hope can someone help. Thanks !</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em sex, 27 de set de 2019 às 02:33, Michel Macena <<a href="mailto:mmacena.eng@gmail.com">mmacena.eng@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'm using an ERC32 chip (sparc) . Do you mean the console driver ?</div><div> <br></div><div><br> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter, 24 de set de 2019 às 20:47, Chris Johns <<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 21/9/19 8:39 am, Michel Macena wrote:<br>
>  I noticed in the IO primitive manager section in the RTEMS POSIX guide that<br>
> there are a read and a write function, however the IO guide are not finished<br>
> yet, so I don't know if those functions are in good shape to use. Are they ok ?<br>
> Also is there a tcdrain (from termios.h) equivalent function for RTEMS?<br>
> <br>
> I want to make a hardware loop with the board and a pc with linux through serial<br>
> communication. Is there any RTEMS specific functions  to send and receive data<br>
> through serial UART ?<br>
<br>
RTEMS supports termios for UART communications. All you need is a driver for<br>
your hardware.<br>
<br>
Chris<br>
</blockquote></div>
</blockquote></div>