PDA

View Full Version : InitUart at 115200 gives error message


cpusa
08-07-2008, 12:10 PM
I'm trying to modify the Transparent Master example to work at 115200.

initUart(1, 115200) gives me the following error message:

Int out of range.

Does the Uart support 115200 baud or is there a alternate constant that I should be using?

Thanks,

Tom Johnson






"""Sample script for the multi-drop serial master device.
Load this script into the MASTER device. It will broadcast serial data to the SLAVE devices,
and periodically announce its MASTER status to all.
"""

from switchboard import *

# Maximum number of hops allowed for multicast forwarding
numHops = 3

secondCounter = 0

def startup():
# Initialize UART
initUart(1, 115200) # was 9600 baud
flowControl(1, False) # No flow control

# Connect UART to transparent data endpoint.
# The default transparent configuration is broadcast
crossConnect(DS_UART1, DS_TRANSPARENT)

# Enable bridge connections on the other UART
crossConnect(DS_UART0, DS_PACKET_SERIAL)

def announceMaster():
"""Broadcast master status. This allows slaves to learn our address, so they can unicast back."""
mcastRpc(1, numHops, 'master')

def poll100ms(mstick):
global secondCounter

# Periodically announce 'master' status to all slaves
secondCounter += 1
if secondCounter >= 10:
announceMaster()
secondCounter = 0

snappyGen.setHook(SnapConstants.HOOK_STARTUP, startup)
snappyGen.setHook(SnapConstants.HOOK_100MS, poll100ms)

mgenti
08-07-2008, 12:32 PM
I'm trying to modify the Transparent Master example to work at 115200.

initUart(1, 115200) gives me the following error message:

Int out of range.

Does the Uart support 115200 baud or is there a alternate constant that I should be using?


Yes, the UART does support 115200, however your throughput will not achieve the full sustained 115200. Also, you will likely need to turn on hardware flow control.

To setup the UART for 115200 you will actually need to use 1 as the speed:

initUart(1, 1)

cpusa
08-07-2008, 01:22 PM
Can you point me to where these constants are specified in the documentation?

Thanks,

Tom Johnson

ThayerScale
08-07-2008, 01:49 PM
I had the same exact issue (question) this morning. Thanks for the timely post. I too would like to know where the arguments and constants for SNAPpy API's are documented. The SNAP Reference Manual is incomplete in it's definitions.

Bob Ahokas

mgenti
08-07-2008, 02:42 PM
The initUart with 1 specifying the baud rate of 115200 is only in the 2.1 beta releases. We are still working on the 2.1 beta and the corresponding documentation so there is unfortunately no where I can currently point you until it is released.

cpusa
08-07-2008, 03:56 PM
Ok, so the 2.0 firmware won't do 115200. What about 38400 or 56K? Please post these constants and a note on which firmware is needed.

Also, I'm trying to use a rs232 onewire device called "The Link" (http://www.ibuttonlink.com/pdf/The%20Link%20Users%20Guide%20V1.2.pdf). It is supposed to be like a DS9097U but it also has a text-interface in additon. When the device is connected to /dev/ttyS0 directly I can access it using the text commands at 9600 baud (such as 'h' for help) and also run the public domain 1-wire samples just fine (which also run at 9600 baud). Unfortunately when wirelessly bridging the serial port I can only get the text commands to work over the snap network but not the 1-wire public domain samples. I've tried turning on hardware flow control but things fail.

We've got tons of code that work over a standard connection, so making the snap network work transparently would be a huge time savings.

Any advice or pointers?

Thanks,

Tom Johnson

kbanks
08-07-2008, 04:04 PM
For 38400 and 57600, just use those numbers directly. Only 115200 literally would not fit in 16 bits, and had to be treated special (and this special handling was added after 2.0 was released).

If you are getting poor performance with a DATA MODE application using 2.0, you will have much greater success with 2.1... In the 2.1 code, you can adjust several timeouts related to DATA MODE buffering.