Both uarts use PLATFORM_BAUDRATE, so changing it would change the baudrate on both uarts. If you want to use different baudrates, the init function inside Atm128UartP.nc is probably the best place to make the change.
On Sun, Oct 19, 2008 at 11:45 PM, Andrey Gursky <[EMAIL PROTECTED]> wrote: > Hi Zhen! > > Li, Zhen Li wrote: >> Hi Andrey: >> >> Thanks for the help. >> >> But I'm still a little confused about the bard rate setting stuff. >> >> Right now I found 4 files maybe related to bardrate setting as: hardware.h, >> Atm128Uart.h, atm128UartP.nc and HplAtm128UartP.nc. >> >> The "hardware.h" locates in $TOSDIR/tos/platforms/micaz/, with an enum as: >> PLATFORM_BAUDRATE = 57600L . Is it the general baudrate for both Uart0 and >> Uart1? So if I change this value, does it mean that the baudrate for UART1 >> will also be changed? >> >> The rest of the files located in $TOSDIR/tos/chips/atm128/. In the >> Atm128Uart.h, there is also an enum which seems to reflect the real baudrate >> regester's readings but I could not find where this values are used. In the >> Atm128UartP.nc, there's a command as Init.init and it seems that the >> baudrate is set roughly there also. And in the HplAtm128UartP.nc, there's a >> command as Atm128Calibrate.baudrateRegister(PLATFORM_BAUDRATE) called with a >> returened value as ubrr0. Then the UBRR0L and UBRR0H was renewed according >> to ubrr0. >> >> So upon the four areas related to baudrate setting, which should I use? > > I personally used the one in hardware.h and calculated the appropriate > m_byte_time in Atm128UartP.nc > After that I could used the baud rate 230400 byte/s. I could measure the > increased speed, although it was not so high. > >> And can you give me some wiring example about using UART0 to receive bytes >> no matter what baudrate it is in? >> > > I didn't ever used UART0, so I haven't unfortunately any example. If I'd > need it, I'd look into the implementation of SerialActiveMessage or > printf, that use UART1. Or maybe there are another components that use > UART0, that could serve as an example. > > I assume UART0 and UART1 use the same PLATFORM_BAUDRATE. > > Best wishes, > Andrey > > >> >> >> ________________________________________ >> From: Andrey Gursky [EMAIL PROTECTED] >> Sent: Wednesday, October 15, 2008 12:55 PM >> To: Li, Zhen Li >> Cc: Tinyos-Help >> Subject: Re: [Tinyos-help] How to set baud rate on UART0 >> >> Li, Zhen Li wrote: >>> Hi >>> >>> Does anyone know how to set the baudrate in TinyOS 2.1 for MicaZ's or >>> IRIS's UART0? I want to set the baudrate to 1200 and I know how to do the >>> baudrate register's calculation but don't know where to put those values. >>> Also, how can I use the UART0 to read some bytes? Can anyone tell me >>> something about the wiring? >>> >>> Thanks! >> >> Hi Zhen! >> >> In $TOSDIR/chips/atm128/HplAtm128UartP.nc there are functions to >> initialize UART0/1. The both use command >> call Atm128Calibrate.baudrateRegister(PLATFORM_BAUDRATE); >> with parameter that is defined in >> $TOSDIR/platforms/micaz/hardware.h >> (I assume IRIS uses also this definition from micaz and not from mica, >> because of the order of includes in $TOSDIR/platforms/iris/.platform) >> So you should alter this parameter only in hardware.h >> >> In >> $TOSDIR/chips/atm128/Atm128UartP.nc >> the command Init.init() >> should be extended with new PLATFORM_BAUDRATE you want to use and the >> appropriate new calculated value m_byte_time. >> >> >> Hope I was not wrong. Best wishes, >> Andrey >> >> > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
