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.

MSP432P4111: [MSP432 Bluetooth plugin] How to increase communication throughput between a host MCU (SAP) and a simple network processor (CC2640R2)

Part Number: MSP432P4111

Hi,

I'm using the simple application processor example in MSP432 BLE plugin to connect between a MSP432P4111-Launch Pad and a CC2640R2-LP. I want to stream ~100kbps from MSP432 to an Android app so my current BLE notification configurations are MTU=220 (bytes) and connection interval = 15ms. However, the current bottleneck is the communication between MSP432 and CC2640R2. Currently, with UART protocol, I can only increase baud rate up to 230400 (which already takes ~11ms to transmit only 220 bytes of data). When I increase it to 460800 on both CC2640R2 Simple network processor (SNP) and MSP432 simple application processor (SAP), only CC2640R2 send out messages while MSP432 doesn't respond.

(Btw, I have been able to stream > 100kbps with CC2640R2 alone. However, because of resource constraints on CC2640R2, I'll need to use another MCU to handle my application.)

Here is captured UART signals after reset at 230400 baud. Both MSP432 and CC2640R2 works properly.

When UART baud rate is increased to 460800. MSP432 doesn't respond to message from CC2640R2.

I tried to configure the same UART in my main function and it can send out data properly at 460800 (baud rate lookup table has been set up to accommodate 460800) so I'm thinking it isn't the issue with UART configuration but perhaps, the BLE SAP library doesn't allow me to use high baud rate. Thus, do have any limitations for UART baud rate inside the MSP432 BLE plugin? I have been looking around its documents but haven't found any clue.

Another way I have tried is to use SPI instead of UART but it seems that the pre-compiled SAP library from MSP432 BLE plugin package doesn't allow me to use SPI. I tried to use compile source files of SAP library instead of pre-compiled one but a header file for is missing (npi_tl_spi.h)

  • Hi, 

    Nhat Pham said:
    but a header file for is missing (npi_tl_spi.h)

    C:\ti\simplelink_cc2640r2_sdk_2_30_00_28\source\ti\blestack\npi\src\inc
    C:\ti\simplelink_cc2640r2_sdk_2_30_00_28\source\ti\blestack\npi\src\unified\inc
    C:\ti\simplelink_cc2640r2_sdk_2_30_00_28\source\ti\ble5stack\npi\src\inc

  • Hi Tom,

    Thanks for your answer!
    I forgot to add that I'm trying to build the Simple Application Processor (SAP) library with SPI communication on the MSP432 side which has the missing SPI header.
    I think the ones that you're talking about is to build the Simple Network Processor (SNP) with SPI communication on CC2640R2. I have been able to build it already. :-)

    Btw, how do you think about the UART baud rate? I still have no clue why it can be increased to 460800.

    Cheers,
    N.
  • Hi Nhat,

    Nhat Pham said:
    Btw, how do you think about the UART baud rate? I still have no clue why it can be increased to 460800.

    Some MSPs, some silicon releases have issues with 1-2 Mbps UART speeds. 
    Having no experience with MSP432P4111, I recommend you to create a separate thread asking for the best experience on UART speeds with MSP-EXP432P4111, DMA settings, etc.

  • I would confirm the power level of the MSP432.

     *  The Power driver currently supports four pre-defined performance levels:
     *  @code
     *    Level    MCLK (MHz)    HSMCLK (MHz)    SMCLK (MHz)    ACLK (Hz)
     *    -----    ----------    ------------    -----------    ---------
     *      0         12              3              3           32768
     *      1         24              6              6           32768
     *      2         48             24             12           32768
     *      3         48             48             24           32768

    Table 24-5 in the TRM shows the error associated for a given BRCLK (SMCLK) and desired baud rate.

    Regards,

    Chris 

  • Hi Tom and Chris,

    I'm not sure that I got it right but it seems to me that the issue of UART baud rate is inside the MSP432 BLE plugin (i.e. the simple application processor (SAP) library). When I tried to use the same UART on MSP432, without attaching it to the SAP library, to send out some dummy data at 460800, I can see it sends out data properly through a logic analyzer. Thus, I'm wondering whether we have any limitation for UART baud rate in the SAP library or not?

    P.s: About the use of SPI for the MSP432 BLE plugin, I found out in the user's guide that it only supports UART. "The SAP layer supports a physical UART Network Processor Interface (NPI) layer between the SimpleLink host MCU and the CC26xx. ". So I think I will skip SPI and stick with UART for now.

    Cheers,

    Nhat.

  • What is the difference between the SAP pluggin and the UART example? Can you provide any information regarding the clock settings?

    Thanks,
    Chris
  • Have you made any progress in identifying the clocks? Looking at the example on the web I see that the power level is '2' so that the SMCLK would be 12Mhz. What is the clock speed of the UART example? Can you simply update your application to use power level '3' to see if that addresses the issue?

    Regards,
    Chris
  • Since there have been no updates, I assume that the original suggestion has addressed the issue.

    Regards,
    Chris
  • Hi Chris,

    I'm looking into the clock now and I'll let you know if I found anything. One interesting thing I have tried is to use the same UART to transmit data out at 460800 baud instead of assigning to the BLE SAP library, and it does transmit. But the BLE SAP doesn't work with the same UART at that baud rate and above (it does work with 230400, though.). The code I use is from the simple_application_processor example in MSP432 BLE plugin

    // The code is working. UART can transmit data out.

    char input[3] = {0x01, 0x02, 0x03};
    UART_Handle uart;
    UART_Params uartParams;

    // Create a UART with data processing off.
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 460800;
    // Open an instance of the UART drivers
    uart = UART_open(Board_UART1, &uartParams);

    UART_write(uart, &input, 3);

    // The SAP library is not working when sapParams.port.remote.bitRate is increased to 460800

    /* Initialize UART port parameters within SAP parameters */
    if (SAP_initParams(SAP_PORT_REMOTE_UART, &sapParams) != SNP_SUCCESS) {
    Display_print0(displayOut, 0, 0,
    (char* ) "SAP_initParams: SNP_INVALID_PARAMS");
    }

    sapParams.port.remote.mrdyPinID = Board_MRDY;
    sapParams.port.remote.srdyPinID = Board_SRDY;
    sapParams.port.remote.boardID = Board_UART1;
    sapParams.port.remote.bitRate = 460800;

    /* Setup NP module */
    if (SAP_open(&sapParams) != SNP_SUCCESS) {
    Display_print0(displayOut, 0, 0, (char* ) "SAP_open: SNP_FAILURE");
    }

  • Have you looked at the NPITask_Params_init()?  I am not very familiar with this but stumbled across this wiki:

    Chris

  • Hi Chris,

    The one that you showed is the SNP library on CC2640R2 module. On CC2640R2, I can increase baudrate to 921600 without any problem. However, to use the Network Processor solution, we need another library (i.e. the SAP) on the Application MCU to communicate with SNP on CC2640R2. I saw TI does provide SAP library for MSP432 in BLE plugin (with UART protocol)[1]. To make sure it's clear, the UART baudrate on the SAP library is the one that I'm stuck with.

    Cheers,
    NP.

    [1] dev.ti.com/.../users_guide_simplelink_sdk_plugin.html
  • Please update the board file () to add UART details for 460800 baudrate if you intend to support that as well. This structure should have details for all baudrates that may be supported by the application

  • Hi Kasthuri,

    I already setup the UART baudate table. My display library is running with UART baudrate 921600.

    Cheers,

    NP.

  • NP,
    I have reached out to some of my colleagues to clarify, but to me it looks like there are three separate pieces to consider. The first is the power profile which selects the frequency of the SMCLK which sources the EUSCI peripheral for UART communication. The second is the UART configuration found in the board file (MSP_EXP432P4111.c). It is not clear to me what is the relationship between the .inputClockFreq and the SMCLK setting in the power profile. The third is the Network Peripheral Interface which is linked into the project. Again, it is not clear how the UartParams in the NPI are applied. I will reply back to this post on the 28th with any findings.

    Chris
  • Hi NP,

    I'm not sure at a glance why setting the baud rate via the SAP library to 460800 is not working. Could you send the project with your changes that supports 230400 but fails on 460800?

    Best regards,
    Kristen
  • Hi Kristen,

    It's the sample_application_processor [1] example provided inside SIMPLELINK-SDK-BLUETOOTH-PLUGIN_1.40.00.42 [2]. The hardware setup is the same as the example where MSP432P4111LP is used with CC2640R2LP

    I only make 2 small changes:

    1. In the sample_application_processor for MSP432, increase UART baud rate when initializing SAP library.

    case AP_RESET: {
          /* Make sure CC26xx is not in BSL */
          GPIO_write(Board_RESET, Board_LED_OFF);
          GPIO_write(Board_MRDY, Board_LED_ON);
    
          usleep(10000);
    
          GPIO_write(Board_RESET, Board_LED_ON);
    
          /* Initialize UART port parameters within SAP parameters */
          if (SAP_initParams(SAP_PORT_REMOTE_UART, &sapParams) != SNP_SUCCESS) {
            Display_print0(displayOut, 0, 0,
                (char* ) "SAP_initParams: SNP_INVALID_PARAMS");
          }
    
          sapParams.port.remote.mrdyPinID = Board_MRDY;
          sapParams.port.remote.srdyPinID = Board_SRDY;
          sapParams.port.remote.boardID = Board_UART1;
          sapParams.port.remote.bitRate = 460800;
    
          /* Setup NP module */
          if (SAP_open(&sapParams) != SNP_SUCCESS) {
            Display_print0(displayOut, 0, 0, (char* ) "SAP_open: SNP_FAILURE");
          }
    
          /* Register Application thread's callback to receive
           asynchronous requests from the NP. */
          SAP_setAsyncCB(AP_asyncCB);

    2. Change the UART baud rate in the simple_np_cc2640r2lp_app on the CC2640R2 side to accept the new baud rate.

    uint8_t NPITask_Params_init(uint8_t portType, NPI_Params *params)
    {
      if (params != NULL)
      {
        *params = NPI_defaultParams;
    
    #if defined(NPI_USE_UART)
        UART_Params_init(&params->portParams.uartParams);
        params->portParams.uartParams.readDataMode = UART_DATA_BINARY;
        params->portParams.uartParams.writeDataMode = UART_DATA_BINARY;
        params->portParams.uartParams.readMode = UART_MODE_CALLBACK;
        params->portParams.uartParams.writeMode = UART_MODE_CALLBACK;
        params->portParams.uartParams.readEcho = UART_ECHO_OFF;
        params->portParams.uartParams.baudRate = 460800;
    #elif defined(NPI_USE_SPI)
        SPI_Params_init(&params->portParams.spiParams);
        params->portParams.spiParams.mode = SPI_SLAVE;
        params->portParams.spiParams.bitRate = 8000000;
        params->portParams.spiParams.frameFormat = SPI_POL1_PHA1;
    #endif //NPI_USE_UART
    
        return NPI_SUCCESS;
      }
    
      return NPI_TASK_INVALID_PARAMS;
    }

    I don't think we have any problem on CC2640R2 side because if you take a look at the logic analyzer capture in my first post, CC2640R2 can send out Power-up indicator message with baud rate at 460800, only MSP432 doesn't respond.

    Btw, I can zip the current projects and send them to you, but since I have changed a lot in the code to fit with my customized hardware, it won't work directly with the Launchpads anymore.

    [1]  

    [2]  

  • Any update?
  • I'm still stuck with this and I currently fall back to use a Bluetooth SPP module (i.e. RN-42). Still, it's only temporary, though.

  • Thank you for the update. I am still unclear how to best resolve this. With the holiday, I will not be able to revisit this until after the 19th.

    Regards,
    Chris

  • I am still looking at this.  I made the following minor changes per your description:

    sapParams.port.remote.bitRate = 460800;

     and also added the baud rate definitions:

        {460800, 24000000, 3,  4,   0, 1},
        {460800, 12000000, 26, 0,   0, 0},

    I can verify that both UARTs are being configured.  The one that communicates with the PC terminal is at 115200 and the other is at 460800.  However, looking back at the baud rate calculator the baud rate definitions appear incorrect.  For 460800 and 12Mhz, the values should be 1,10,0,1.  Can you please verify how you are calculating the baud rate?

    Thanks,
    Chris

**Attention** This is a public forum