Custom serial port baud rate

Posted by: Shonky

Custom serial port baud rate - 25/04/2002 03:17

Can someone tell me how and where to set a custom baud rate in the kernel - there are so many references to baud rates etc in the source. Or should I be able to set a custom rate without kernel mods? It seems that either the player software or the kernel is ignoring my car_rate= line in config.ini.

I need to set a rate of around 1500 baud to talk to my Alpine CD changer.
Posted by: wfaulk

Re: Custom serial port baud rate - 25/04/2002 13:37

It might be that you're using 1500 as the value. I looked at this before, and I remember some references to specific bitrates in the serial driver. Try setting it to 1200 and see if it works then. (I realize that this might not solve your problem, but it might at least explain why it's not working.)
Posted by: Shonky

Re: Custom serial port baud rate - 25/04/2002 17:03

Hmmm.... Well I have hacked the kernel so that when I set a rate of 2400 in my application it actually sets it to 1500 in serial_sa1100.c. i.e. I'm not relying on config.ini at all anymore.

It seems to work in the sense that my PC at 1500 baud gets the data correctly, but the changer doesn't understand it whereas the changer understands the PC fine. I need to put it on a DSO and see if there's something obvious. I'm pretty sure I have it at 8N1 correctly etc.
Posted by: tfabris

Re: Custom serial port baud rate - 25/04/2002 17:09

Flow control maybe?
Posted by: Shonky

Re: Custom serial port baud rate - 25/04/2002 17:27

Don't think so. I have code to turn it off and my PC is receiving it OK with no flow control.
Posted by: TommyE

Re: Custom serial port baud rate - 26/04/2002 05:39

Hmm, does the Alpine have a standard RS232 port??

If so, cool.

TommyE
Posted by: snoopstah

Re: Custom serial port baud rate - 26/04/2002 13:40

I imagine not, otherwise he wouldn't need a custom baud rate (1200 and 2400 are 'standard' serial speeds). But pretty much anything *can* be controlled by serial if you're prepared to put time and effort into it.
Posted by: Shonky

Re: Custom serial port baud rate - 27/04/2002 20:12

Definitely not standard RS232 or even standard serial really. It's a single wire open collector type data line. Also it's technically not even 1500 baud really. It sends 0s and 1s by different length on and off pulses. It just so happens that you can 'shonk' the same effect by talking at roughly 1500 baud and sending some special characters. For each 4 bits of data I actually send two bytes (ie 16 bits) of 1500 baud 8N1 data.
Posted by: Shonky

Re: Custom serial port baud rate - 27/04/2002 21:26

OK well I seem to have the baud rate problem kludged with my kernel hack. Now can someone tell me what I should do to access the serial port? Do I have to disable the player software or something else so that the kernel messages etc go somewhere else.

What are others doing who are using the serial port?

The problem I have is that since the system is 1 wire, everything that you send you also immediately receive back. So I send some data get it echoed back by the 1 wire system, then the kernel/player echoes it back to the port which then echoes back via the 1 wire system. A vicious circle follows....
Posted by: altman

Re: Custom serial port baud rate - 30/04/2002 01:46

Run the player with -s- to turn off the serial port.

If you're getting echo, you need to put the fd into raw mode - see cfmakeraw() and friends.

Hugo