Re: [beagleboard] UART communication in Beaglebone Black

2015-05-17 Thread glslang
I believe it can be now since v3.19.x but we don't know the kernel version 
he's using so all we can do is guess :(.

There's a recent thread here with some links with instructions on how to 
set it up so perhaps the OP can give that a go :thumbup:.

On Sunday, May 17, 2015 at 8:35:45 AM UTC+1, Davide Picchi wrote:

 Are you sure, that you selected the right UART port???

 It should be 
 /dev/ttyO0

 or 
 /dev/ttyO1

 and so on...but not 
 /dev/ttySx



 On Tuesday, April 28, 2015 at 9:19:31 PM UTC+2, Peter Hurley wrote:

 On 04/27/2015 06:41 AM, JAY KOTHARI wrote: 
  Hi, 
  I am unable to do simple uart communication in BBB. I have set 
 device tree 
  
  uart2_pins: uart2_pins { 
  pinctrl-single,pins =  
  0x154 0x01 
  0x150 0x31 
 ; 
  }; 
  
  uart2 { 
  status = okay; 
  pinctrl-names = default; 
  pinctrl-0 = uart2_pins; 
  }; 
  
  then I configure the UART Port 
  
  stty -F /dev/ttys0 cstopb -evenp ispeed 115200 
^ 
 stty: /dev/ttys0: No such file or directory 

 uart2 is not /dev/ttyS0. 

 uart0 = /dev/ttyS0 
 uart1 = /dev/ttyS1 
 uart2 = /dev/ttyS2 

 Regards, 
 Peter Hurley 


  Then I made a user space application for reading and writing data to 
  device file. I have attached the application program 
  
  I connected Tx and Rx pin in same BBB.(Loop back mode) 
  
  But  I am not able to do simple UART communication in loop back 
  mode. Do am I missing something? Please help me 



-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
BeagleBoard group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [beagleboard] UART communication in Beaglebone Black

2015-05-17 Thread Davide Picchi
Are you sure, that you selected the right UART port???

It should be 
 /dev/ttyO0

 or 
 /dev/ttyO1

 and so on...but not 
 /dev/ttySx



On Tuesday, April 28, 2015 at 9:19:31 PM UTC+2, Peter Hurley wrote:

 On 04/27/2015 06:41 AM, JAY KOTHARI wrote: 
  Hi, 
  I am unable to do simple uart communication in BBB. I have set 
 device tree 
  
  uart2_pins: uart2_pins { 
  pinctrl-single,pins =  
  0x154 0x01 
  0x150 0x31 
 ; 
  }; 
  
  uart2 { 
  status = okay; 
  pinctrl-names = default; 
  pinctrl-0 = uart2_pins; 
  }; 
  
  then I configure the UART Port 
  
  stty -F /dev/ttys0 cstopb -evenp ispeed 115200 
^ 
 stty: /dev/ttys0: No such file or directory 

 uart2 is not /dev/ttyS0. 

 uart0 = /dev/ttyS0 
 uart1 = /dev/ttyS1 
 uart2 = /dev/ttyS2 

 Regards, 
 Peter Hurley 


  Then I made a user space application for reading and writing data to 
  device file. I have attached the application program 
  
  I connected Tx and Rx pin in same BBB.(Loop back mode) 
  
  But  I am not able to do simple UART communication in loop back 
  mode. Do am I missing something? Please help me 



-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
BeagleBoard group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [beagleboard] UART communication in Beaglebone Black

2015-04-28 Thread Peter Hurley
On 04/27/2015 06:41 AM, JAY KOTHARI wrote:
 Hi,
 I am unable to do simple uart communication in BBB. I have set device tree
 
 uart2_pins: uart2_pins {
 pinctrl-single,pins = 
 0x154 0x01
 0x150 0x31
;
 };
 
 uart2 {
 status = okay;
 pinctrl-names = default;
 pinctrl-0 = uart2_pins;
 };
 
 then I configure the UART Port
 
 stty -F /dev/ttys0 cstopb -evenp ispeed 115200
   ^
stty: /dev/ttys0: No such file or directory

uart2 is not /dev/ttyS0.

uart0 = /dev/ttyS0
uart1 = /dev/ttyS1
uart2 = /dev/ttyS2

Regards,
Peter Hurley


 Then I made a user space application for reading and writing data to
 device file. I have attached the application program
 
 I connected Tx and Rx pin in same BBB.(Loop back mode)
 
 But  I am not able to do simple UART communication in loop back
 mode. Do am I missing something? Please help me

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
BeagleBoard group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[beagleboard] UART communication in Beaglebone Black

2015-04-27 Thread JAY KOTHARI
Hi,
I am unable to do simple uart communication in BBB. I have set device 
tree

uart2_pins: uart2_pins {
pinctrl-single,pins = 
0x154 0x01
0x150 0x31
;
};

uart2 {
status = okay;
pinctrl-names = default;
pinctrl-0 = uart2_pins;
};

then I configure the UART Port

stty -F /dev/ttys0 cstopb -evenp ispeed 115200

Then I made a user space application for reading and writing data to
device file. I have attached the application program

I connected Tx and Rx pin in same BBB.(Loop back mode)

But  I am not able to do simple UART communication in loop back
mode. Do am I missing something? Please help me


-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
BeagleBoard group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

//Filename: uart.c
//
//Project : UART
//Author  : Jay Kothari
//Contact : jaikothar...@gmail.com
//Date:



#include stdio.h
#include stddef.h
#include time.h
#include termios.h
#include fcntl.h
#include unistd.h
#include sys/types.h
#include string.h


int pauseNanoSec(long nano);
void pauseSec(int sec);


int main(int argc, char *argv[])
{
	char buf[30] = /dev/minettyO1;
	
	//UART config using termios
	struct termios uart1,old;
	int fd;
	unsigned char buf2 = 0xA7;
	fd = open(buf, O_RDWR | O_NOCTTY);
	if(fd  0) printf(port failed to open\n);

	while(1)
	{
		write(fd,buf2,1);
		pauseNanoSec(500);
		if(read(fd,buf2,1)  0)
			printf(%c,buf2);
		pauseNanoSec(500);
	}

	close(fd);

	return 0;
}

int pauseNanoSec(long nano)
{
	struct timespec tmr1,tmr2;

	tmr1.tv_sec = 0;
	tmr1.tv_nsec = nano;

	if(nanosleep(tmr1,tmr2)  0)
	{
		printf(Nano second pause failed\n);
		return -1;
	}
}

void pauseSec(int sec)
{
	time_t now,later;

	now = time(NULL);
	later = time(NULL);

	while((later - now)  (double)sec)
		later = time(NULL);
}