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.

CCS/MSP432P4111: Some problems using driver lib

Part Number: MSP432P4111

Tool/software: Code Composer Studio

Good Morning,

I am developing a board with the controller in object. 

On board there are some UART, SPI, I2C e ADC...

I need some suggestion for my application. I would like to know if I can contact a field application in Italy.

Thanks in advance

Alfredo

  • Hi Alfredo,

    thanks for using the forum.

    Can you give us a short description of the issues you have?

    Based on that we can see what would be the best solution to support you.

    Of course you can always contact the local TI offices for support.

    Best regards

    Kostas

  • Hi Alberto,

    it has been a while since our last communication.

    Could you give us an update of the status?

    Thanks

    Regards

    Kostasan

  • Hi Kostasan,

    sorry for my delayed reply.

    I try to describe what I need.

    I am developing a firmware on a board with a lot of sensors and activation how described in the precedent post, the microcontroller is MSP432P4111.

    I realized each single function for all the hardware.

    Now I would like Send command on Uart based on one FTDI, by Personal computer.

    I realized the interrupt serial routine with the IRQ Handler.

    My questions are:

    I defined following  eUSCI_UART_Config in my generic.c module

       const eUSCI_UART_Config confUSB=
        {
             EUSCI_A_UART_CLOCKSOURCE_SMCLK,                // clock Source
             45, //91,                                      // clock Prescaler 9600
             9, //2,                                        // firstModReg
             0,                                             // secondModReg
             EUSCI_A_UART_NO_PARITY,                        // parity
             EUSCI_A_UART_LSB_FIRST,                        // msborLsbFirst
             EUSCI_A_UART_ONE_STOP_BIT,                     // numberofStopBits
             EUSCI_A_UART_MODE,                             // uartMode
             EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION, // oversampling
             EUSCI_A_UART_8_BIT_LEN                         // 8 bit
        };

    Then I would like to define in my header file.

    Another question is why I have to declare Prescaler to 91 e firstModReg to 2 for 9600 baud rate but I obtain 4800 baud.

    Then I do not understand why I have to include the Header file msp432p401m_classic.h

    Following my Check RX Buffer:

    void Check_RX_USB_Buffer(void)
        {
            unsigned char nChar0;
            //unsigned char rx_end;
            unsigned char rx_xor0;
            unsigned char calc_xor0;
            unsigned char ok_xor0;
    
            Cons0 = rx_cons0;
            USBIncConsumer();
    
            nChar0 = 0;
            calc_xor0 = 0;
            rx_stx_err0 = 0;
            rx_etx_err0 = 0;
            rx_len_err0 = 0;
            rx_xor_err0 = 0;
            rx_end0 = RXLength0;      // **************
    
            while (nChar0 != rx_end0 ) //
            {
                USBIncConsumer();
    
                if (Cons0 != rx_prod0)   // Buffer OK
                {
                    // Process
                    rxbuffer_empty0 = 0;
                    rxbuffer_decode0 = 0;
    
                    if (nChar0 == 0)
                    {
                        if (RX_Buf0[Cons0] != 'S')
                        {
                            // STX Error
                            rx_stx_err0 = 1;
                            rxbuffer_decode0 = 0;
                            break;
                        }
    
                    }
    
                    else if (nChar0 == 3)
                    {
                        if ( RX_Buf0[Cons0] > 20 )
                        {
                            // LEN Error
                            rx_len_err0 = 1;
                            rxbuffer_decode0 = 0;
                            decode_ok0 = 1 ;//decode_OK
                            break;
                        }
                        else
                        {
                            // LEN OK
                            len_Data0 = RX_Buf0[Cons0];   // **************
                            rx_end0 = len_Data0 + 6;      // **************
                            rxbuffer_decode0 = 0;
                        }
    
                    }
    
                    else if (nChar0 == rx_end0 - 2 ) // **************
                    {
                        rx_xor0 = RX_Buf0[Cons0];
                        ok_xor0 = calc_xor0;
                    }
    
                    else if (nChar0 == rx_end0 - 1 ) // **************
                    {
                        if (RX_Buf0[Cons0] != 3)
                        {
                            // ETX Error
                            rx_etx_err0 = 1;
                            rxbuffer_decode0 = 0;   //decode_OK
                            decode_ok0 = 1 ;        //decode_OK
                            break;
                        }
                        else
                        {
                            // ETX OK
                            rxbuffer_empty0 = 0;
                            rxbuffer_decode0 = 0;
                            // Check_Xor
                            if (rx_xor0 != ok_xor0)
                            {
                                rx_xor_err0 = 1; //decode_OK
                                rxbuffer_decode0 = 0;
                                decode_ok0 = 1 ;//decode_OK
                                break;
                            }
    
                            else
                            {
                                rx_xor_err0 = 0;
                                rxbuffer_decode0 = 1;
                                rxbuffer_empty0 = 0;
                                break;
    
                            }
                         }
    
                    }
    
                    calc_xor0 = calc_xor0 ^ RX_Buf0[Cons0];
                    nChar0++;
                }
    
                else                        // Buffer empty
    
                    {
                        rxbuffer_empty0 = 1;
                        rxbuffer_decode0 = 0;
                        break;
                    }
            }
            if (rxbuffer_decode0 == 0)
            {
    
                if (rxbuffer_empty0 != 1)
                {
                    USB_Bad_Update();
                }
           }
    
            else
            {
                USB_Good_Update();
            }
    
    
            return;
    
        }
    

    Following the error:

                    else if (nChar0 == 3)
                    {
                        if ( RX_Buf0[Cons0] > 20 )
                        {
                            // LEN Error
                            rx_len_err0 = 1;
                            rxbuffer_decode0 = 0;
                            decode_ok0 = 1 ;//decode_OK
                            break;
                        }
    In expression windows I see RX_Buf0[Cons0] = 3 I do not understand why the condition of If is True?

    The last question, do you have an example code with control hardware by Uart?

    Thanks in advance

    Alfredo
  • Hi Alfredo,

    first sorry for the name confusion.

    I am not sure I fully understand all, but let's start step by step first

    Examples: you can find examples in the TI resource explorer. I would suggest to start with that first, if you not have done that already.

    The TIREX can be found online: Choose the right device and see the available examples.

    or you can access TIREX directly in CCS (view-->Resource Explorer)

    There are 2 examples on the MSP432P4111 regarding the UART.

    - eUSCI_UART_Config: I see you are using the SMCLK, what is the frequency you are using? What is the divider setting?

    To calculate the Prescaler and  firstModReg, TI provides a tool to calculate these parameters:

    - Regarding the Header file msp432p401m_classic.h: it is not required. Why you have included?

    Can you please check the information above first and let me know if the helps. We can further discuss additional question.

    Let me know

    Regards

    Kostas

**Attention** This is a public forum