Has anyone gotten one of these to work?? I’m trying to communicate with a USB flash drive though this IC, via UART on an MSP430F1611. However I have not been able to get any responce when I run the following code. The CTS# pin(referenced from the uP) never goes high. Thus character are never received or transmitted.
Thanks in advance.
-Jon
;----------------------------------------------------------------------------
; Initialization Sequence
#include <msp430x14x.h>
ORG 01100h
RESET mov.w #0A00h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
bis.b #001h, &P1DIR ; Use P1.0 as output
bic.b #001h, &P1OUT
bis.b #030h, &P3SEL ; Use P3.4,5 for UART0
bis.b #050h, &P3DIR ; Use P3.4,6 as output
bis.b #040h, &P5DIR ; Use P5.6 for DREQ
bis.b #040h, &P5OUT ;
mov.b #004h, &BCSCTL1 ; Setup Clocks
mov.b #088h, &BCSCTL2 ;
mov.b #002h, &IFG1 ;
SetOsc0 bic.b #OFIFG, &IFG1 ; Test Oscilator
mov.w #0FFh, R15 ;
SetOsc1 dec.w R15 ;
jnz SetOsc1 ;
bit.b #OFIFG, &IFG1 ;
jnz SetOsc0 ;
mov.b #021h, &U0TCTL ; Setup U0TCTL
mov.b #008h, &U0RCTL ; Setup U0RCTL
mov.b #baudDiv0, U0BR0 ; Setup Baud Rate Clock
mov.b #baudDiv1, U0BR1 ;
mov.b #baudMod, U0MCTL ;
bis.b #0C0h, &ME1 ; Enable UART Transmitters
mov.b #010h, &U0CTL ; UART0 Released
mov.b #000h, &P1IES ; Port 1: Low=>High Transition Cause Interupts
bic.b #0FFh, &P1IFG ; Clear any existing Port 1 Interupt Flags
mov.b #002h, &P1IE ; Allow P1.1 to Cause Interupts
bis.b #GIE, R2 ; Enable global interupts
;----------------------------------------------------------------------------
; Super_Loop
mov.w &fromUSB, R5 ; R5 is a pointer to a table where data is received from the UART
Super_Loop mov.w &toUSB, R4 ; R4 is pointer to data being sent to UART
call #UART0_TX ; transmit character subroutine
jmp Super_Loop ; Do nothing
;----------------------------------------------------------------------------
; UART0 TX Subroutine
UART0_TX bic.b #002h,&P1IE ; Disable Interupts Caused by P1.1
bis.b #rts, &P1OUT ; Set P1.1 (RTS# on uP, #CTS on USB Host)
poll_CTS_TX bit.b #cts, &P1IN ; Wait for CTS#(uP) to set
jz poll_CTS_TX
poll_TX bit.b #TXEPT, &U0TCTL ; Wait until U0 TX Buffer is Empty
jz poll_TX
mov.b @R4,U0TXBUF ; Transmit Selected Character
bic.b #rts, &P1OUT ; Reset P1.1 (RTS# on uP, #CTS on USB Host)
bis.b #002, &P1OUT ; Enable Interupts Caused by P1.1
ret ; return from subroutine
;--------------------------------------------------------------------------
; P1.1 Interupt Handler (for UART RX, activated on rising edge of #CTS
P1_ISR bit.b #cts, &P1IFG ; test P1_ISR Trigger
jz end_ISR ;
bis.b #rts,&P1OUT ; Set P1.1 (RTS# on uP, CTS# on Host)
poll_RX bit.b #040h, &IFG1 ; Poll UART RX Flag until 1
jz poll_RX
mov.b &U0RXBUF, 0(R5) ; Move RXed Char to Address pointed to by R5, post inc.
inc.b R5
end_ISR mov.b #000h, &P1IFG ; Reset All P1 Interupt Flags
bic.b #rts,&P1OUT ; Reset P1.1 (RTS# on uP, CTS# on Host)
reti ; return from interupt
;---------------------------------------------------------------------------
; Memory
toUSB DW testDataTx ; pointer to table where data is transmitted
fromUSB DW testDataRx ; pointer to table where data is received
testDataTx DW 00Dh ; Data to be transmitted to USB
testDataRx DW 0, 0, 0, 0, 0, 0, 0, 0 ; Data received from USB Host
DW 0, 0, 0, 0, 0, 0, 0, 0
;---------------------------------------------------------------------------
;Interupt Vectors
ORG 0FFFEh
DW RESET
ORG 0FFE8h
DW P1_ISR
;--------------------------------------------------------------------------
;EQUATES
baudDiv0 EQU 041h
baudDiv1 EQU 003h
baudMod EQU 000h
rts EQU 001h
cts EQU 002h
end