Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CCS/MSP430F5529: MSP430 as USB HID device and separate UART communication

$
0
0

Part Number:MSP430F5529

Tool/software: Code Composer Studio

I am using code from msp430ware example H0_simplesend, which allows HID communication from msp430 to an android device with a TI app. This by itself works for me. In another project, I am communicating with a UART device using at 9600 BAUD on UART channel A0, again by itself I've this functionality works. All this code is using msp430ware driverlib.

Combining USB HID communication into my project, however, causes UART communication to fail.  Specifically I've found that in the below setup code, the USB_Setup function breaks my UART functionality. UART RX interrupts are not happening after that function has been called. I've tried diving into the USB_setup function to see what could be changing, but found it to be very complex. Any insight into what I could do to get UART comms to work alongside USB HID comms would be much appreciated. I am simply trying to send data received from the UART device over USB to the android device. I have only included what I figure is the important setup code so if more code from my project is needed just let me know.

    PMM_setVCore(PMM_CORE_LEVEL_2);
    USBHAL_initPorts();           // Config GPIOS for low-power (output low)
    USBHAL_initClocks(8000000);   // Config clocks. MCLK=SMCLK=FLL=8MHz; ACLK=REFO=32kHz
    USB_setup(TRUE,TRUE);  // Init USB & events; if a host is present, connect
    
    GPIO_setAsPeripheralModuleFunctionInputPin(UCA0TXD_PIN);
    GPIO_setAsPeripheralModuleFunctionInputPin(UCA0RXD_PIN);
    GPIO_setAsOutputPin(RED_LED);

// UART init - 9600 BAUD
USCI_A_UART_initParam uart_a0_param = {0}; uart_a0_param.selectClockSource = USCI_A_UART_CLOCKSOURCE_SMCLK; uart_a0_param.clockPrescalar = 109; uart_a0_param.firstModReg = 0; uart_a0_param.secondModReg = 2; uart_a0_param.parity = USCI_A_UART_NO_PARITY; uart_a0_param.msborLsbFirst = USCI_A_UART_LSB_FIRST; uart_a0_param.numberofStopBits = USCI_A_UART_ONE_STOP_BIT; uart_a0_param.uartMode = USCI_A_UART_MODE; uart_a0_param.overSampling = USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION; if(USCI_A_UART_init(USCI_A0_BASE, &uart_a0_param) == STATUS_FAIL) { GPIO_setOutputHighOnPin(RED_LED); while(1) { __no_operation(); } } USCI_A_UART_enable(USCI_A0_BASE); USCI_A_UART_clearInterrupt(USCI_A0_BASE, USCI_A_UART_RECEIVE_INTERRUPT); USCI_A_UART_enableInterrupt(USCI_A0_BASE, USCI_A_UART_RECEIVE_INTERRUPT); __enable_interrupt();


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>