element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum MSP430F479: The UART received data is not correct
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 1 reply
  • Subscribers 464 subscribers
  • Views 260 views
  • Users 0 members are here
  • ti msp430
  • uart
Related

MSP430F479: The UART received data is not correct

sadique
sadique over 6 years ago

Hi,

I am facing a little problem with the bluetooth communication with my MSP430F479. I am using the BM70 ble module. I am trying to send two words over the transmit pin and as the buffer can only contain one byte, I am sending the Upper byte first and then the lower byte by swapping. The received first byte in the mobile app (to see the bluetooth transmitted data) is always correct that is as sent by the TX pin (using a breakpoint after each transmit to check the received byte). But for the second byte and third byte data transmitted, I am not getting the right data (it is showing wrong byte of data in the app) . The UART baud rate of the MSP430 is set 115200 Hz as the default baud rate of the BM70 ble module is also the same. I am attaching the code simulated in the IAR embedded workbench below:

#include <msp430.h>

;-------------------------------------------------------------------------------

ORG 01100h ; Program Start

;-----------------------------------------------------------------------------

RESET mov.w #0A00h,SP ; Initialize stackpointer

StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT

SetupFLL bis.b #XCAP11PF,&FLL_CTL0 ; Configure load caps

SetupP1 bis.b #03h,&P1DIR ; P1.1 and P1.2 output (LD1 output set to make the BM70 in application mode)

bis.b #03h,&P1OUT

OFIFGcheck bic.b #OFIFG,&IFG1 ; Clear OFIFG

mov.w #047FFh,R15 ; Wait for OFIFG to set again if

OFIFGwait dec.w R15 ; not stable yet

jnz OFIFGwait

bit.b #OFIFG,&IFG1 ; Has it set again?

jnz OFIFGcheck ; If so, wait some more

SetupP2 bis.b #BIT4+BIT5,&P2SEL ; P2.4,5 USCI option select

SetupUART

bis.b #UCSSEL_2,&UCA0CTL1 ; SMCLK

mov.b #09,&UCA0BR0 ; 1MHz 115200

mov.b #00,&UCA0BR1 ; 1MHz 115200

mov.b #02,&UCA0MCTL ; Modulation

bic.b #UCSWRST,&UCA0CTL1 ; **Initialize USCI state machine**

bis.b #UCA0RXIE,&IE2 ; Enable USCI_A0 RX interrupt

Mainloop mov.w #0F349h,R7 ;data to be sent

mov.w #1234h,R6 ;data to be sent

TZ1 bit.b #UCA0TXIFG,&IFG2 ; USCI_A0 TX buffer ready?

jz TZ1 ; Jump if TX buffer not ready

swpb R7 ;swapping the bytes

mov.b R7, &UCA0TXBUF ;send most significant byte

swpb R6 ; Prepare to send High Byte of Sum

TZ2 bit.b #UCA0TXIFG,&IFG2 ; USCI_A0 TX buffer ready?

jz TZ2 ; Jump if TX buffer not ready

mov.b R6, &UCA0TXBUF ; Send High Byte of Sum

swpb R6

TZ3 bit.b #UCA0TXIFG,&IFG2 ; USCI_A0 TX buffer ready?

jz TZ3 ; Jump if TX buffer not ready

swpb R6

mov.b R6, &UCA0TXBUF ; Send Low Byte of sum

LEND bis.b #LPM3+GIE,SR ; Enter LPM3, interrupts enabled

nop

;------------------------------------------------------------------------------

USCIA0RX_ISR; Echo back RXed character, confirm TX buffer is ready first

;------------------------------------------------------------------------------

TX0 bit.b #UCA0TXIFG,&IFG2 ; USCI_A0 TX buffer ready?

jz TX0 ; Jump if TX buffer not ready

;mov.b &UCA0RXBUF,&UCA0TXBUF ; TX -> RXed character

bic.w #LPM3,0(SP) ; Turn the CPU back on

reti ;

;

;------------------------------------------------------------------------------

; Interrupt Vectors

;------------------------------------------------------------------------------

ORG 0FFFEh ; RESET Vector

DW RESET ;

ORG 0FFF2h ; USCI_A0 Rx Vector

DW USCIA0RX_ISR ;

END

  • Sign in to reply
  • Cancel
Parents
  • rsjsouza
    rsjsouza over 6 years ago

    I don't have IAR nor the same device, but there is are several assembly example projects in the TI Resource Explorer

     

    An assembly implementation of a 115200bps full duplex UART and using USCIA0 is available at this link (there are others).

     

    Hopefully this helps you figure out the exact conditions for your project.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • rsjsouza
    rsjsouza over 6 years ago

    I don't have IAR nor the same device, but there is are several assembly example projects in the TI Resource Explorer

     

    An assembly implementation of a 115200bps full duplex UART and using USCIA0 is available at this link (there are others).

     

    Hopefully this helps you figure out the exact conditions for your project.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube