Jump to content
justlovecoding

ttyS0 - failed to request DMA, use interrupt mode

Recommended Posts

Hello,

As the ASUS Tinker Board has so many wonderful features and direct access of lower level peripherals, I've decided to migrate my development from raspberry Pi to Tinker board. Right now, I'm starting with a basic UART code which sends and receive some strings serially but unfortunately it is not working as expected. The UART I'm trying to use UART1 (Pin number 8 and 10).

Right now,  if (serialDataAvail(fd)) is getting true every single time. After reading the data serialGetchar(fd), I found out that, the RX pin is in low state (receiving 255 continuously).
Although, my code has no error, but I'll still add it here.

#include <stdio.h>
#include <string.h>
#include <errno.h>

#include <wiringPi.h>
#include <wiringSerial.h>

int main ()
{
  int fd,inCount = 0 ;
  char inBuff[500],OutBuff[500];

  if (wiringPiSetup () == -1)
  {  fprintf (stdout, "Unable to start wiringPi: %s\n", strerror (errno)) ;
     return 1 ;  }
  else
     printf("wiringPi: init successfull! \n\r");	
  

  if((fd = serialOpen ("/dev/ttyS0", 115200)) < 0)
    { fprintf (stderr, "Unable to open serial device: %s\n", strerror (errno)) ;
      return 1 ;  }
  else
      printf("Serila: /dev/ttyS0 successfully opened! \n\r");
  
  
    while (1)
    {  if (serialDataAvail(fd))		
         {
               inBuff[inCount] = serialGetchar(fd);
	  if ( inBuff[inCount] == '\n')
             {
	       printf("RX String=%s");
	       memset(inBuff,'\0',inCount);
	       inCount = 0 ;
	     }
	      	  inCount++;
	     if ( inCount == 500)
	        { inCount  = 0;
	          memset(inBuff,'\0',inCount);
	        }
         }    
    }

}


 

The reply of "dmesg | grep tty" is attached below. spacer.png

2021-07-03.png

Edited by justlovecoding

Share this post


Link to post
Share on other sites

Hi justlovecoding:
    Pin number 8 and 10 is UART1
    Can you try as follows??
    if((fd = serialOpen ("/dev/ttyS1", 115200)) < 0)
    Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...