EmbeddedRelated.com
Forums

MSP430F417 UART

Started by mikenz88 November 7, 2007
Hi There,

Is it possible to use the Boot Strap Loader (BSL) interface for device
communications as well as programming?

Otherwise I have the application note for using a timer to create a UART

Cheers

Mike

Beginning Microcontrollers with the MSP430

Yes.

Do you use assembly code? If so, I can show you how to use it.
--- In m..., "mikenz88" wrote:
>
> Hi There,
>
> Is it possible to use the Boot Strap Loader (BSL) interface for device
> communications as well as programming?
>
> Otherwise I have the application note for using a timer to create a UART
>
> Cheers
>
> Mike
>
The BSL-ROM code is using Timer to implement a simplex uart.
Yes, you can call the BSL-ROM routines for communication.

However, there are many different versions of BSL-ROM. It depends on
the part number of the MSP430. Which chip are you using?

--- In m..., "mikenz88" wrote:
>
> Hi There,
>
> Is it possible to use the Boot Strap Loader (BSL) interface for device
> communications as well as programming?
>
> Otherwise I have the application note for using a timer to create a UART
>
> Cheers
>
> Mike
>
I am interest in use BSL for communication, too. It can help us to
save code size from reuse the BSL UART code.

Could you show us, what to do? Thanks in advance!
have a good day
Ken

--- In m..., "mikenz88" wrote:
>
> Hi There,
>
> Is it possible to use the Boot Strap Loader (BSL) interface for
device
> communications as well as programming?
>
> Otherwise I have the application note for using a timer to create a
UART
>
> Cheers
>
> Mike
>
You can call the asynchronous serial Receive-a-Character and
Transmit-a-Character subroutines in the BSL of a MSP430F417 under the
following conditions:
(a) You must set up and use P1.0 as the serial output.
(b) You must set up and use P1.1 as the serial input.
(c) MCLK must be faster than 100*BAUD. For example, to use 9600b/s,
you need to have MCLK>0.96MHz.
(d) You need to set up the word at RAM 0x0202-0x0203 to [MCLK/BAUD].
For example, if MCLK=1MHz and BAUD00b/s, this word need to be 100
(0x0064).
(e) You need to set up the word at RAM 0x0204-0x0205 to
[(MCLK/BAUD)/2-30]. For example, if MCLK=1MHz and BAUD00b/s, this
word need to be 20 (0x00).
(f) You must set up TimerA to count in Continuous Mode. The counting
rate should be the same as MCLK.
(g) You can do either serial input or serial output. You cannot do
both at the same time.
(h) You cannot handle interrupts while doing either serial input or
serial output.
(i) You must use Even Parity. You have none, 1-byte or 2-byte
block-checksum options.

For the checksum options, do one of the followings:
(1) If you do not want checksum, set R9 to 0x1000 or 0x1001 before you
call the subroutines. The subroutines will change R9 from 0x1000 to
0x1001 and from 0x1001 to 0x1000. Thus subsequent calls do not need to
set R9 again.
(2) If you want a 1-byte XOR checksum, set R9 to 0 every time you call
the subroutines. The subroutines will update a 1-byte checksum at
0x0212 and change R9 to 1. You need to initialize and read the
checksum yourself.
(3) If you want a 2-byte XOR checksum, set R9 to 0 when you initialize
the checksum. The subroutines will update a 2-byte checksum at
0x0212-0x0213 and change R9 from 0 to 1 or from 1 to 0 to select which
byte to update. You need to initialize and read the checksum yourself
but you should not change R9.

In addition to the above, to Receive-a-Character, you do the following:
CLR R11
CALL #0x0F56
The character will be returned in R12.
R11:BIT1 is an error flag.
R5 is destroyed.
RAM 0x0209 is destroyed.

To Transmit-a-Character, you do the following instead:
MOV.B [Character], R12
CALL #0x0EEA
R11 is destroyed
R5 is destroyed
RAM 0x0207 is destroyed.

--- In m..., "To_chi_kin" wrote:
>
> I am interest in use BSL for communication, too. It can help us to
> save code size from reuse the BSL UART code.
>
> Could you show us, what to do? Thanks in advance!
> have a good day
> Ken
>
> --- In m..., "mikenz88" wrote:
> >
> > Hi There,
> >
> > Is it possible to use the Boot Strap Loader (BSL) interface for
> device
> > communications as well as programming?
> >
> > Otherwise I have the application note for using a timer to create a
> UART
> >
> > Cheers
> >
> > Mike
>
--- In m..., "old_cow_yellow"
wrote:
>
> You can call the asynchronous serial Receive-a-Character and
> Transmit-a-Character subroutines in the BSL of a MSP430F417 under
the
> following conditions:
> (a) You must set up and use P1.0 as the serial output.
> (b) You must set up and use P1.1 as the serial input.
> (c) MCLK must be faster than 100*BAUD. For example, to use 9600b/s,
> you need to have MCLK>0.96MHz.
> (d) You need to set up the word at RAM 0x0202-0x0203 to [MCLK/BAUD].
> For example, if MCLK=1MHz and BAUD00b/s, this word need to be 100
> (0x0064).
> (e) You need to set up the word at RAM 0x0204-0x0205 to
> [(MCLK/BAUD)/2-30]. For example, if MCLK=1MHz and BAUD00b/s, this
> word need to be 20 (0x00).
> (f) You must set up TimerA to count in Continuous Mode. The counting
> rate should be the same as MCLK.
> (g) You can do either serial input or serial output. You cannot do
> both at the same time.
> (h) You cannot handle interrupts while doing either serial input or
> serial output.
> (i) You must use Even Parity. You have none, 1-byte or 2-byte
> block-checksum options.
>
> For the checksum options, do one of the followings:
> (1) If you do not want checksum, set R9 to 0x1000 or 0x1001 before
you
> call the subroutines. The subroutines will change R9 from 0x1000 to
> 0x1001 and from 0x1001 to 0x1000. Thus subsequent calls do not need
to
> set R9 again.
> (2) If you want a 1-byte XOR checksum, set R9 to 0 every time you
call
> the subroutines. The subroutines will update a 1-byte checksum at
> 0x0212 and change R9 to 1. You need to initialize and read the
> checksum yourself.
> (3) If you want a 2-byte XOR checksum, set R9 to 0 when you
initialize
> the checksum. The subroutines will update a 2-byte checksum at
> 0x0212-0x0213 and change R9 from 0 to 1 or from 1 to 0 to select
which
> byte to update. You need to initialize and read the checksum
yourself
> but you should not change R9.
>
> In addition to the above, to Receive-a-Character, you do the
following:
> CLR R11
> CALL #0x0F56
> The character will be returned in R12.
> R11:BIT1 is an error flag.
> R5 is destroyed.
> RAM 0x0209 is destroyed.
>
> To Transmit-a-Character, you do the following instead:
> MOV.B [Character], R12
> CALL #0x0EEA
> R11 is destroyed
> R5 is destroyed
> RAM 0x0207 is destroyed.

Hi,
Is this method applyable only for MSP430F417 uC? or some version of
BSL?

Regards,
Max
All versions have very similar Rx and Tx subroutines. Details vary.
You can dis-assemble the BSL ROM any check them out.

--- In m..., "g0tty0" wrote:
>
> --- In m..., "old_cow_yellow"
> wrote:
>
> Hi,
> Is this method applyable only for MSP430F417 uC? or some version of
> BSL?
>
> Regards,
> Max
>
Thanks old_cow_yellow,

I will definitly try this method!
have a good day
Ken

--- In m..., "old_cow_yellow"
wrote:
>
> All versions have very similar Rx and Tx subroutines. Details vary.
> You can dis-assemble the BSL ROM any check them out.
>
> --- In m..., "g0tty0" wrote:
> >
> > --- In m..., "old_cow_yellow"
> > wrote:
> >
> > Hi,
> > Is this method applyable only for MSP430F417 uC? or some version of
> > BSL?
> >
> > Regards,
> > Max
>