Jump to content
43oh

serial output on linux


Recommended Posts

Linux ws.jgscrater.com 3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24 16:09:20 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
 

MSP430f5529LP

educational boosterpack mark 2

 

lsusb output:

#	w/ launchpad in
Bus 001 Device 004: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 001 Device 002: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
#	w/ launchpad in
Bus 001 Device 005: ID 2047:0013 Texas Instruments 
Bus 001 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120

I've run several of the examples that appear under the "edu mark 2" list.

The ones that do output to the serial port -- I never see.

 

I was guessing that somehow the output would show up in a terminal window,

but, no.

 

Oh, I went to rpmforge and installed the epel....rpm, but yum -y install putty

still does nothing -- no such rpm.  I have no cu, no minicom, no...  So, assuming

I should see something, where do I find it?

 

I did a search on linux serial and it seemed that

the issues I found had to do with energia/uploading.  I can upload the stuff,

I see the blinking light, and energia windows say the upload completes.

So I'm good there.  (Examples to play the tunes work, and so on.)

 

If this isn't the right place to post, tell me.  I considered stuff under Energia

but....  decided against it.

 

Do I write a C program to just endlessly read /dev/ttyACM0 or whatever?

 

Thx.

 

j.

 

Link to post
Share on other sites

sheesh.  is my face red.

 

okay, finally figured out what the magnifying glass in the

upper right corner is for.  though i'd tried it before and the

window just sat there, this time i went to tools->port and

tried all of the ports, and ...  ta-da! there it was.

 

i guess my next trick will be to try to read the serial line

from a program on my "main" computer.

 

sigh.

 

j.

Link to post
Share on other sites

splutter.  well, it's easy, i guess, if you're paying attention.

but if you're like me, then, it's not, evidently.

 

this code works well enough to read the accelerometer serial

example.  obviously, it's trivial....

 

the one gotcha that i saw was that this does nothing if the

serial monitor in energia is also watching the output.  so it

may seem like it's not working.

# include <stdio.h>

#define LL 20

int main(void)
{
char card[LL];
int nlines=0;
char *cgot;

FILE *serial;

serial = fopen( "/dev/ttyACM1","r" );
if( serial != NULL )
	{
	printf("not null....\n");
	while( nlines < 40 )
		{
	cgot = fgets(card,LL,serial);
	if( cgot != NULL )
	{
	printf("%s",card);
		nlines++;
		}
	}
	fclose(serial);
	}
else
	printf("no worky that way\n");

return 0;
}

and, obviously, you need to change the "fopen" line if the port isn't

ttyACM1.

 

sigh.

 

j.

Link to post
Share on other sites
  • 3 weeks later...

you also need to set the parameters for that serial connection.

in your particular case energia is probably doing it for you before you start your program, but if you want your program to work under any conditions you need to do this.

 

see here for an example:

https://github.com/rodan/solar-sensor/blob/master/server/ss_daemon.c#L77

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...