OK, here is where I'm at
**** IMPORTANT: a lot of these things that I'm saying are my own educated
guesses, this is not an enumeration of the correct way of enabling and
using the P8/9 headers. I just want to make that clear. It doesn't
currently work****
The procedure I took was the uEnv.txt route. On my BBBW it is in the /boot
directory ( I noticed that its in different spots on different boards). So
I had to make the directory Read/Write so I did this:
chmod 644 /boot
which makes it R/W for owner and R for group, I think.
The I pico'ed the uEnv.txt file and cut and pasted this line under its
equivalent commented out line:
cape_enable=bone_capemgr.enable_partno=BB-UART1,BB-UART2,BB-UART3,BB-UART4,BB-UART5
...and saved it.
I then rebooted.
>From what I've gathered, this will configured the UART1 thru 5's on the
p8/9 pins to their base UART mode. Then I looked up the pin configurations
in the BBB reference manual and found the pins “named” (I see there are
multiple modes, so I just went with the name of the pin as I figured this
is the default) UART1_TXD, UART1_RXD...UART5_TXD, UART5 RXD.
According to the manual:
UART5_RXD is pin p8_38
UART4_TXD is pin p9_13
I jumpered these physically figuring I would write a short program to shoot
some data across to check that they are transmitting and receiving right (I
don't have an O-Scope). I checked this connection thrice just to make sure
I had the physical layer right.
I gathered from various posts on BB that how you access these serial
connections via the /dev/ttyO1 thru /dev/ttyO5 device streams. I assumed
that you just open a stream to the device and fread and fwrite from them.
Am I correct to do this? Would read and write be better (ie. Using file
handles as opposed to fptr's?) here?
So here is my code:
[code]
//*********************************
// UART 4 to UART 5 connection test
//
// For correctly configured Beagleboard Black Wireless
// (Use uEnv.txt procedure by uncommenting capes you need
// in this case BB_UART4 and BB_UART5)
//
// Remember to physically jumper across:
// P8_38 (UART5_RXD)
// to
// P9_13 (UART4_TXD)
// Important: on a BBBW the P8 is on the RIGHT and the P9 is on the LEFT
// Easy to forget this
// ********************************
#include <stdio.h>
#include <string.h>
main()
{
FILE *dptr1, *dptr2;
char buf[255];
char buf2[255];
//manual clear both test buffers
memset(buf,0,255);
memset(buf2,0,255);
//set test transmit buffer to a value that can be read
strcpy(buf,"Transmit Test String.");
printf("Opening UART4 for transmit\n");
dptr1=fopen("/dev/ttyS4","w");
printf("Opening UART5 for receive\n");
dptr2=fopen("/dev/ttyS5","r");
printf("Writing test string \"%s\" to UART4_TXD\n",buf);
fwrite(buf,sizeof(buf),1,dptr1);
fflush(NULL);
printf("Receiving test string from UART5_TXD\n");
fread(buf,sizeof(buf2),1,dptr2);
printf("Received test string: %s\n",buf2);
fclose(dptr1);
fclose(dptr2);
}
[/code]
All this code when compiled and run does is send a test string out UART4_TX
out to UART5_RX.
OK, THE MOMENT OF TRUTH: what happens when I do this?
The program outputs:
Opening UART4 for transmit
Opening UART5 for receive
Writing test string "Transmit Test String." to UART4_TXD
Receiving test string from UART5_TXD
^C
...it hangs on the receive (so I'm not even sure if it transmitted
correctly) why I included the caret C to indicate where I had to stop
execution with a <ctrl>C because it hung there.
Any ideas?
On Thursday, March 9, 2017 at 5:17:59 AM UTC-7, woody stanford wrote:
>
> OK, I want to get to the bottom of this whole GPIO issue on the BBB, so
> I'm opening up this thread as a "documenter" whereby which I can take notes
> based on my research into how you consistently, stably and SOLIDLY
> programatically access the GPIO pins on a BBB. I've already done a lot of
> the footwork so I'm not entirely unknowledgeable, but I want to get to the
> heart of this issue and solve the mental block people have with this. A
> private hope.
>
> Either way, probably a good mess of processed links, articles and
> information where you can start.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/567b5a93-367a-409e-9b63-f9c4548b3fcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.