This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5529: MSP430 / USB and printf error

Part Number: MSP430F5529

Hi,

I use a MSP430F5529 launchpad to work with USB and a PC with Linux / CCS 12.3.0.00005.

I use a Texas Instruments USB example. This is the code :

void main (void)
{
    WDT_A_hold(WDT_A_BASE);                                                                                         // Stop watchdog timer

    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

    __enable_interrupt();                                                                                           // Enable interrupts globally

    printf("Test\n");

    while (1)
    {
        switch (USB_getConnectionState())                                                                           // Check the USB state and directly main loop accordingly
        {
            case ST_ENUM_ACTIVE:                                                                                    // This case is executed while your device is enumerated on the USB host
                __bis_SR_register(LPM0_bits + GIE);                                                                 // Enter LPM0 (can't do LPM3 when active)
                _NOP();
                if (bHIDDataReceived_event)                                                                         // If true, some data is in the buffer; begin receiving a cmd
                {
                    uint8_t dataReceived[MAX_STR_LENGTH] = "";
                    USBHID_receiveDataInBuffer(dataReceived, MAX_STR_LENGTH, HID0_INTFNUM);
                    bHIDDataReceived_event = FALSE;
                }
                break;

            case ST_PHYS_DISCONNECTED:
            case ST_ENUM_SUSPENDED:
            case ST_PHYS_CONNECTED_NOENUM_SUSP:
                __bis_SR_register(LPM3_bits + GIE);
                _NOP();
                break;

            case ST_ENUM_IN_PROGRESS:
                printf("Here!\n");
                break;

            default:
                _NOP();
                break;
        }

    }
}

If i remove the line with "printf("Here!\n");", the code works perfectly with the host but if i want to write in the console with "printf("Here!\n");" command, the USB connection failed and i have this messages :

MSP430: Can't Run Target CPU: Could not run device (to breakpoint)
MSP430: Trouble Halting Target CPU: Internal error

Is there a particular setting to be made to make the command "printf" compatible with the USB framework?

Thank you.

Christophe

**Attention** This is a public forum