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.

MSP432P401R: With the same code but it cannot run on MSP432 Red version launchpad

Part Number: MSP432P401R

Hi all,

I've purchase a new MSP432 Red version launchpad from TI. Currently, I have 2 MSP432 launchpads, one is Black version (old version) and the other is the new one. With the same code, the Back version work well but not for the Red version.

In the User guide of the Red version, it said that there is no change of functionality. The changes is only the hardware of the launchpad (change position of buttons, JTAG). Therefore, my code should work correctly on the Red version but it does not.

Is any one here has the same problem? If so, could you please share me the solution for this situation?

Thanks in advance guys.

Hau Le.

  • Can you give us more details, or share a short test case that shows the problem?
  • Hi Keith,

    In my project, I use the ADC14 combine with DMA to sample audio signal using a microphone on BOOSTXL-AUDIO booster pack from TI. Sampled data will be saved into 2 buffers (I use ping-pong mode for DMA). This sampled data will be simply output to the DAC on the BOOSTXL-AUDIO via SPI bus. Audio signal sampled /played back in sample rate of 20kHz.

    I use an infinity loop to write the sampled data into the DAC.

    I flashed the code into the MSP432 black version launchpad, the code work well, I can here the repeated audio that have been sampled from the microphone. But with the same code, the MSP432 red version launch pad does not work. I did some test and find out that the infinity loop only give me 64 loops, therefore my data will never output to the DAC.

    In additional, I can watch the sampled data via Graph in CCS. Audio sampling side (ADC, DMA) work well on both launchpad. On the red version launch pad, output data never change (keep zero).

    With another code, I use the Kentec touch display from TI. It also use SPI as the communication channel. Again, the black version launchpad work well, every think is OK, but with the red version, the display shown nothing, just black at all.

    So I think that might be the issue come from the SPI module, but I'm not sure.
  • " If so, could you please share me the solution for this situation?"

    you want others to help you debug a piece of code that they don't have. how's that possible?

    you have the code and you can step through and see where it hangs.
  • Hello Hau,

    The Black Launchpad has an older pre-production version of the MSP432P401R device. The Red LaunchPad uses the latest production version. Also there have been API changes as we moved the version of Silicon and this is part of the SimpleLink SDK.

    I would strongly suggest to move your application to the SDK.
  • Hi Atmit,

    Thank you so much for your information. Curently I'm using the latest version of MSP432 SDK for my project with MAP prefix in function calls. I'v tried to factory reset the launchpad but the code still doesn't work on it.

    In additional, I'm using the latest CCSv8.

    Do you have any other suggestion?

    Best regards,

  • Hi Danny,

    I'm sorry for that. The reason why I did not post my code here because it is quite complicated and might cost a lot of time to understand. It has been separated into several of files and folder corresponding for each function module. The easy way to quickly understand it is import whole of my project into CCS, then you will understand easily the structure of my project and how it works.

    I'm trying to solve the problem. Thank you any way.

    Best regards,
  • Hi Amit,

    I've do some test in other simple project and I found that every peace of code that placed into while(1) loop inside main() will not run.
    I've moved my code into an interrupt handler then it runs correctly. This is not happed on the Black board.

    Does TI change something that make code inside the while(1) loop cannot be run?

    Thanks,
  • Hello Hau,

    Code's may always be complicated. Just by stating it works on the older LP and not on the newer LP, there is not much we can support to help you root cause the issue. You will need to debug the code, see what the output is on pins (check for data and clock frequency on source synchronous interfaces, baud rates).
  • Hello Hau,

    Since, we only use the Red LP, you can send me the "simple" example in form of a CCS project that I can run with the latest SDK. Please do make sure that I do not need an external device to communicate with as I may not have exact devices at my disposal.
  • Here are the changes in the Silicon:
    www.ti.com/.../slaz610o.pdf

    Though you might need to google "MSP432P401R errata" to find rev B if that is on your board.

    Look to see if any of these might be your problem. I would especially check the sleep issues. You are not giving us much to go on here.

    I can assure you that while(1) is still an endless loop.
  • Hi Amit,

    Here is the simple test code. Red LED and RGB Blue LED will be toggle periodically by using timer interrupt. I use the latest SimpleLink MSP432 SDK and no external device are required.

    #include <stdint.h>
    #include <stdbool.h>
    #include <ti/devices/msp432p4xx/driverlib/driverlib.h>
    
    void Clock_Init(void);
    void GPIO_Init(void);
    
    static uint8_t count = 0;
    static bool select;
    
    uint16_t iii = 0;
    
    /*
     * Main function
     */
    int main(void)
    {
        /* Halt the watch dog timer*/
        MAP_WDT_A_holdTimer();
    
        /* Disable master interrupt */
        MAP_Interrupt_disableMaster();
    
        /* Enable FPU with lazy stacking enabled for floating point operations in ISRs */
        MAP_FPU_enableModule();
        MAP_FPU_enableLazyStacking();
    
        /* Initialize system clock and GPIO pins */
        Clock_Init();
        GPIO_Init();
    
        /* Enable sleeping on ISR exits and enables master interrupt */
        MAP_Interrupt_enableSleepOnIsrExit();
        MAP_Interrupt_enableMaster();
    
        /* Red LED */
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0);
    
        /* RGB Blue LED */
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P2, GPIO_PIN2);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P2, GPIO_PIN2);
    
        const Timer_A_UpModeConfig upModeConfig_A3 =
        {
         TIMER_A_CLOCKSOURCE_ACLK,
         TIMER_A_CLOCKSOURCE_DIVIDER_1,
         0x07FF,
         TIMER_A_TAIE_INTERRUPT_DISABLE,
         TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE,
         TIMER_A_DO_CLEAR
        };
    
        /* Configure timer A3 in up mode */
        MAP_Timer_A_configureUpMode(TIMER_A3_BASE, &upModeConfig_A3);
        MAP_Interrupt_enableInterrupt(INT_TA3_0);
        MAP_Timer_A_clearTimer(TIMER_A3_BASE);
        MAP_Timer_A_startCounter(TIMER_A3_BASE, TIMER_A_UP_MODE);
    
        while (1)
        {
            /* This peace of code cannot run if I put it here */
            if (select)
            {
                MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
                MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P2, GPIO_PIN2);
            }
            else
            {
                MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P2, GPIO_PIN2);
                MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0);
            }
    
            MAP_PCM_gotoLPM0();
        }
    }
    
    void TA3_0_IRQHandler(void)
    {
        /* Clear timer A3 capture compare interrupt flag */
        MAP_Timer_A_clearCaptureCompareInterrupt(TIMER_A3_BASE, TIMER_A_CAPTURECOMPARE_REGISTER_0);
    
        if (count++ == 8)
        {
            select = !select;
            count = 0;
        }
    
        /* This peace of code can run normally if I un-comment it */
    //    if (select)
    //    {
    //        MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
    //        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P2, GPIO_PIN2);
    //    }
    //    else
    //    {
    //        MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P2, GPIO_PIN2);
    //        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0);
    //    }
    }
    
    /*
     * Initialize clock signals
     */
    void Clock_Init(void)
    {
        /* Sets operation voltage to Vcore1 and use DC-DC converter */
        MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
        MAP_PCM_setPowerState(PCM_AM_DCDC_VCORE1);
    
        /* Sets wait state */
        MAP_FlashCtl_setWaitState(FLASH_BANK0, 2);
        MAP_FlashCtl_setWaitState(FLASH_BANK1, 2);
    
        /* Set DCO centered frequency to 48MHz */
        MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48);
    
        /* Initializing clock signals */
        MAP_CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );
        MAP_CS_initClockSignal(CS_HSMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );
        MAP_CS_initClockSignal(CS_ACLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);
    }
    
    /*
     * Initialize GPIOs
     */
    void GPIO_Init(void)
    {
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P2, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P2, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P3, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P3, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P4, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P4, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P5, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P5, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P6, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P6, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P7, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P7, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P8, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P8, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P9, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P9, PIN_ALL16);
    
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P10, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P10, PIN_ALL16);
    }
    

    Thank you so much.

  • Simple: step through your code on the new chip and see where it hangs.

    Or reduce it to a minimalist piece and have others help you debug.

    No other solution.
  • Any variables modified in an interrupt handler (like select) needs to be volatile. It is likely that the while loop runs never changing the value of select, since it figures that it never changes. A really smart optimiser might even just optimise the if away.
  • Hi Keith,

    Thank you so much for the information. I'll investigate it.

    Regards,
  • Hi Keith,

    Thanks for your information. I've change the var "collect" to be volatile but nothing change. But I've found the reason for my issue. As you mentioned before, the issue may come from sleep. I've modified my code from

    MAP_Interrupt_enableSleepOnIsrExit();

    to

    MAP_Interrupt_disableSleepOnIsrExit();

    the code is now run correctly. Thank you so much for your support.

  • "the code is now run correctly."

    that's an interesting fix.

    So you have to enable sleep on exit to run on the old chip, and you have to disable it to run on the new chip? 

  • Hi Danny,

    Exactly! I've tried to debug it and saw that all of my interrupt subroutine can executed correctly. The only logic that cannot be executed is inside the while(1) loop. Whenever ISRs exit, CPU enters to a loop that wait for interrupt (found it in assembly code while debugging) and will not return to the while(1) loop. This caused the while (1) loop only run from the beginning to the very first interrupt event.

    I have not tested the case that disable sleep on ISR exit on the old chip because I've just install CCSv8, the latest version of CCS. This version does not allow me to flash the old launchpad. But one thing that I can sure is all of my projects are enabled sleep on ISR exit, if I disable it, all of my projects can run correctly on the new chip. Might be I'll test the old chip with sleep on ISR exit disabled in the future.

    Thank you guys so much for helping me.

**Attention** This is a public forum