From: Joost M. <joo...@ho...> - 2007-06-08 09:26:29
|
Hi, I forgot to add in my previous mail, that after trying to free the serial port (ttyS0), my gumstix does not start automatically anymore. I believe that the u-boot bootloader does not run the "boot", "bootm", or "bootd" command anymore. Because when I type these from the bootloader I can successfully (manually) start my Gumstix. Did anyone have similar problems before? >From: "Joost Meijles" <joo...@ho...> >Reply-To: "General mailing list for gumstix users." ><gum...@li...> >To: gum...@li... >Subject: Re: [Gumstix-users] Writing to Serial port >Date: Fri, 08 Jun 2007 09:09:11 +0000 > >Hi Craig, and Others, > >I tried to free the ttyS0, as specified on the gumstix wiki >(http://docwiki.gumstix.org/Tips_and_tricks). Although after freeing the >ttyS0 my gumstix does not boot anymore. >Moreover, when monitoring the output written to the ttyS0 I do not see any >messages that could bother my protocol. Could it be that the switching of >parity goes wrong? Or does anyone know what I could do more to fix this? > > >Kind regards, > >Joost > > > >From: Craig Hughes <cr...@gu...> > >Reply-To: "General mailing list for gumstix users." > ><gum...@li...> > >To: "General mailing list for gumstix users." > ><gum...@li...> > >Subject: Re: [Gumstix-users] Writing to Serial port > >Date: Thu, 7 Jun 2007 08:03:46 -0700 > > > >Joost, > > > >did you disable console output to /dev/ttyS0? If not, then the > >console messages which the kernel writes to /dev/ttyS0 might be > >messing with your serial comms protocol... > > > >C > > > >On Jun 7, 2007, at 7:51 AM, Joost Meijles wrote: > > > > > Hi All, > > > > > > I am trying to write something to the serial port of the gumstix > > > (the serial > > > port is located on the tweener expansion board). First I connected the > > > gumstix to my PC via serial. When doing this I listen on the PC > > > side what is > > > written to serial port on the Gumstix side. This seems to work > > > correctly > > > (since I am writing bytes, some characters do not appear on the > > > screen). > > > However, when connecting the device I want to control to the > > > Gumstix it does > > > not work correctly. Now is the case that for the device I want to > > > control a > > > specific protocol is needed. The key element in this protocol is to > > > switch > > > from "space" to "mark" parity and vice-versa. Please see the code > > > below > > > where I do the setup in the first snippet, and I do the switching > > > of parity > > > in the second snippet. > > > > > > My feeling says that something goes wrong when cross-compiling the > > > code to > > > the Gumstix hardware. > > > Since the same code is working fine on my PC Linux machine (i.e. I can > > > successfully control the device). Does anyone have experience with > > > this? Or > > > can anyone give me a clue were to look? Maybe someone experienced > > > problems > > > with "termios.h" before? > > > > > > Thanks a lot in advance. > > > > > > > > > Kind regards, > > > > > > Joost Meijles > > > PS. Reading from the serial port goes fine. > > > > > > ================SETUP============ > > > int fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY); > > > tcflush(fd, TCIOFLUSH); > > > debug("serial port open"); > > > //configure the serial port > > > struct termios options; > > > > > > if(tcgetattr(fd, &options) < 0) // READ SETTINGS > > > { > > > debug("error getting serial port configuration"); > > > } > > > > > > cfmakeraw(&options); > > > cfsetospeed(&options, B115200); // SET SPEED > > > cfsetispeed(&options, B115200); > > > > > > options.c_iflag &= ~CLOCAL; // Set ... > > > options.c_cflag |= CLOCAL; > > > options.c_iflag &= ~CREAD; > > > options.c_cflag |= CREAD; > > > > > > options.c_iflag &= ~CSTOPB; // SET STOPBITS > > > > > > options.c_iflag &= ~PARENB; // SET PARITY BITS > > > options.c_iflag &= ~PARODD; > > > > > > // Odd > > > options.c_cflag |= PARENB; > > > options.c_cflag |= PARODD; > > > > > > > > > options.c_iflag &= ~CS5; // SET DATABITS > > > options.c_iflag &= ~CS6; > > > options.c_iflag &= ~CS7; > > > options.c_iflag &= ~CS8; > > > > > > // 8 databits > > > options.c_cflag |= CS8; > > > > > > options.c_cflag &= ~CRTSCTS; // SET HARDWARE FLOW CONTROL to none > > > > > > > > > if(tcsetattr(fd, TCSANOW, &options) < 0) // WRITE SETTINGS > > > { > > > debug("error writing configuration to serial port"); > > > } > > > =========================================== > > > > > > ===============SWITCH===================== > > > //switch the parity for writing > > > tcgetattr(fd, &options);//get the configuration > > > options.c_cflag &= ~PARENB; > > > options.c_cflag &= ~PARODD; > > > options.c_cflag |= PARENB | 010000000000; > > > options.c_cflag &= ~PARODD; > > > if(tcsetattr(fd, TCSAFLUSH, &options) < 0) {//set the configuration > > > debug("error writing configuration to serial port"); > > > } > > > ============================================ > > > > > > _________________________________________________________________ > > > Vind alles terug op je PC: Windows Live Search Toolbar http:// > > > desktop.msn.nl > > > > > > > > > ---------------------------------------------------------------------- > > > --- > > > This SF.net email is sponsored by DB2 Express > > > Download DB2 Express C - the FREE version of DB2 express and take > > > control of your XML. No limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > _______________________________________________ > > > gumstix-users mailing list > > > gum...@li... > > > https://lists.sourceforge.net/lists/listinfo/gumstix-users > > > > > >------------------------------------------------------------------------- > >This SF.net email is sponsored by DB2 Express > >Download DB2 Express C - the FREE version of DB2 express and take > >control of your XML. No limits. Just data. Click to get it now. > >http://sourceforge.net/powerbar/db2/ > >_______________________________________________ > >gumstix-users mailing list > >gum...@li... > >https://lists.sourceforge.net/lists/listinfo/gumstix-users > >_________________________________________________________________ >Eindeloos zoeken naar dat ene document is nu voorbij! Klik hier >http://toolbar.live.com > > >------------------------------------------------------------------------- >This SF.net email is sponsored by DB2 Express >Download DB2 Express C - the FREE version of DB2 express and take >control of your XML. No limits. Just data. Click to get it now. >http://sourceforge.net/powerbar/db2/ >_______________________________________________ >gumstix-users mailing list >gum...@li... >https://lists.sourceforge.net/lists/listinfo/gumstix-users _________________________________________________________________ Vind alles terug op je PC: Windows Live Search Toolbar http://desktop.msn.nl |