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.

SIMPLELINK-MSP432-SDK: Flash Memory Issues - Marginal Read Example

Part Number: SIMPLELINK-MSP432-SDK

Hello,

I am using the MSP432P401R microcontroller and I have been experiencing odd behaviors during run-time where my program will either skip over some logic or get stuck at certain points. I am attempting to figure out what may be causing the issue, and I would like to look into the integrity of what's in memory. Is it possible that the code region is being marginally programmed during firmware uploads? I use the BSL with the BSL-Scripter to load firmware.

If this is possible, does anyone have any examples of how to use marginal reads? I have attempted a solution using the MSP Driver Library, but I am not sure if it is 100% correct. I appreciate your help in advance.

{
   volatile uint32_t *a = (uint32_t *)addr;

   SETUP_CLOCK_1MHZ();
   for (uint16_t n = 0;  n < size;  n += sizeof(*a), ++a) {
      uint32_t v0, v1, vs;

      FlashCtl_setReadMode(FLASH_BANK0, FLASH_MARGIN1_READ_MODE);
      v1 = *a; 
      FlashCtl_setReadMode(FLASH_BANK0, FLASH_MARGIN0_READ_MODE);
      v0 = *a; 
      FlashCtl_setReadMode(FLASH_BANK0, FLASH_NORMAL_READ_MODE);
      vs = *a; 
      if (v1 != vs || v0 != vs) { 
         SETUP_CLOCK_FAST(); 
         return 0; } 
   } 
   SETUP_CLOCK_FAST(); 
   return 1; 
}



Thanks,
Zach
  • Hi Zach,

    It's highly unlikely that the FLASH memory is being marginally programmed.  My first thought would be to try reading out memory after it has been programmed and compare to a known good image.  Can you reduce your code to the absolute smallest size, but still demonstrates the issue and share?  What tools are you using?  CCS?

  • Hi Zach,

    Any luck reducing your code?  What tools are you using?

  • Hi Zach,

    It's been a few days since I have heard from you so I’m assuming you were able to resolve your issue.
    If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

  • Hi Dennis!

    Thanks for the help and pointing me in the right direction. I am using CCS, yes. I have reduced my code below. The check I am doing above seems to pass every time, so I am thinking you are right about that.. I am starting to wonder if the interrupt table is doing something unexpected, so i will check the memory browser and update with results. I made a recent change to include the buttonCheck because I was getting an issue with accidental double button presses. Is there a reason that clearing interrupts like this would cause potential issues? I know it's not an elegant solution..

    Also, the concern is we are using a custom board (I know this is posted to the Simplelink MSP432 page, but couldn't find the correct forum for the MSP432P401R). The Vcore pin was unintentionally left floating, and later we found that this pin should have been tied to a 100 nF capacitor. Could something like this be causing our issue?

    while(1)
    {
        main_menu(); //displays the main test menu
        if (flag1)
        {
            buttonCheck(); //delays & clears pending pushbutton interrupts
            clearFlag();
            Foo();
        }
        else if (flag2)
        {
            buttonCheck(); //delays & clears pending pushbutton interrupts
            clearFlag();
            Foo();
        }
        PCM_gotoLPM0();
    }
    
    Port3_IRQHandler (void) //pushbutton ISR
    {
        uint32_t status;
        status = GPIO_getEnabledInterruptStatus(GPIO_PORT_P3)
        for(debCount = 0; debCount < 10000; debCount++);
        MAP_GPIO_clearInterruptFlag(GPIO_PORT_P3, status);
        if(status & GPIO_PIN6)
            flag1 = true;
        else if(status & GPIO_PIN7)
            flag2 = true;
    }

  • Hi Zach,

    Yes, the 100nF cap is very important.  It helps to regulate the Vcore voltage and act as a 'tank' capacitor to provide current when some CPU operations may draw more current from the internal LDO.  If you don't have one, put one in somehow.

    Regarding the buttons and double presses, this is very common when using mechanical buttons.  When you push the button, the mechanical switching may toggle many times until it settles.  This is called bouncing and you need to have some way to 'debounce' the switch.  One way is to have a series resistor between the button and the MCU IO pin, plus a small cap on the same side as the resistor and switch.  This creates an 'RC' circuit that effectively filters out the mechanical bouncing.  The other way is in software, which sounds like you figured this out.  By disabling the interrupt after the first interrupt, you are preventing a double triggering effect.  One way to improve on this is after disabling the interrupt, check the state of the IO pin after 20msec or so.  The switch should have rested in its final state by then so you can get a valid state.

  • Hi Zach,

    I haven’t heard from you for a couple of days now, so I’m assuming you were able to resolve your issue.
    I'll change the status of this posting to RESOLVED, but if this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.