PDA

View Full Version : RF200 UART faster than 115200


jcwoltz
06-16-2011, 02:37 PM
I thought I already posted this, but I don't see it. Here is a little script that will peek the various registers on the ATMEGA128RFA1/RF200/SM200 for the UART and display them. This script also has functions to change the UART to a speed faster that 115200. In my testing the RF200 can transfer at 1M, but not sustain the transfer rate for large amounts of data.


""" Test program for RF200 UART Speeds. Diagnostic code and change control.
v2011061100 - Initial Version --jcw
v201106122124 - Add Function to change the speed easily --jcw"""
from synapse.hexSupport import *
from synapse.platforms import *
from synapse.switchboard import *

dverbose = 1
@setHook(HOOK_STARTUP)
def startupEvent():
crossConnect(DS_TRANSPARENT,DS_STDIO)
print "Startup"

def setUART1(speed):
'''Set UART1 RF200 SPeed! 1=1M 3=500k 7=250k'''
initUart(1,9600)
if speed == 7:
poke(0xCC,7)
if speed == 3:
poke(0xCC,3)
if speed == 1:
poke(0xCC,1)

def setUART0(speed):
'''Set UART0 RF200 SPeed! 1=1M, 3=500k, 7=250k'''
initUart(0,9600)
if speed == 7:
poke(0xC4,7)
if speed == 3:
poke(0xC4,3)
if speed == 1:
poke(0xC4,1)

def readu0():
value = peek(0xC6) #UDR0
print "UDR0: " + value
value = peek(0xC0) #UCSR0A
print "UCSR0A: " + value
value = peek(0xC1) #UCSR0B
print "USCROB: " + value
value = peek(0xC2) #UCSR0C
print "UCSR0C: " + value
value = peek(0xC5) #UBBR0H
print "UBBR0H: " + value
value = peek(0xC4) #UBBR0L
print "UDDR0L: " + value
print "End readu0"

def readu1():
value = peek(0xCE) #UDR1
print "UDR1: " + value
value = peek(0xC8) #UCSR1A
print "UCSR1A: " + value
value = peek(0xC9) #UCSR1B
print "UCSR1B: " + value
value = peek(0xCA) #UCSR1C
print "UCSR1C: " + value
value = peek(0xCD) #UBBR1H
print "UBBR1H: " + value
value = peek(0xCC) #UBBR1L
print "UDDR1L: " + value
print "End readu1"