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.

MSP430F5507: Flash and SPI module configuration

Part Number: MSP430F5507

Hi ,

I have a code running on MSP430F5507 , everything is working fine.

But I have the following concerns:

1-   Configure the SPI module UCB1CTL0. While the UCSWRST is 0.

       the register is modified without issues.

 

2-   Write/erase flash without waiting the busy bit. Erase is for 5 segment and I checked the ACCIFG bit is never set, and the erase is completed successfully.

I understand the datasheet, but my concern is why there is no failure. Even if it is not implemented as it should be.

How I can catch such cases if everything is working probably?

3-   Null pointer de-referencing without any issues.(I am working on debugging using memory range access)

But the code composer does not catch such case.

 

Thanks ,

  • Hi,

    Please give me some time to recreate your issue.

    Eason

  • Hi, 

    Sure, I will be waiting ,appreciate your help .

    Thanks.

  • Dina Bino said:
    3-   Null pointer de-referencing without any issues.(I am working on debugging using memory range access)

    But the code composer does not catch such case.

    A NULL pointer of address zero is within the "Reserved for system extension" peripheral address range of 00000h-000FFh on a MSP430x5xx device, and doesn't cause an error on access.

    The MSP430F5507 has a "Embedded Emulation Module (EEM) (S Version)" which can set a watchpoint to trap on an access to address zero. E.g. right click in the CCS Breakpoints view and select (Breakpoint Code Composer Studio) -> Watchpoint and enter zero as the address:

    The program will then halt on breakpoint following a read to write to address zero, albeit the program seems to halt about 2 instructions after the one which performed the access.

    It is also possible to set a "Watch on Data Address Range" to break on any address in the range 0-0xff (the range Reserved for system extension). This is because if a NULL pointer is used for a structure, attempting to access a structure field with a non-zero offset will use an address other than zero:

    The disadvantage of using the "Watch on Data Address Range" compared to the "Watchpoint" is that is uses 2 rather than 1 of the hardware triggers in the S version of the EEM, which can limit the use of other breakpoints.

  • Hi,

    1. About your first question, please refer to our datasheet:

     The default UCSWRST is 1. The code is just to make sure UCSWRST is set.

    About your second question, I think you talk about ACCVIFG. Can you offer your code for me to test? Have you check the busy bit is still set?

    Eason

  • Hi,

    1-      Regarding the first question, the UCB1CTL0 was modified while the bit is set to zero (released for operation).

    Which mean while the module was operating the control register was modified without set/reset the UCSWRST, is this okay?

    2-      I cannot share the full code, but here is a snippet for the erase flash code.

     My concern was it does not wait for busy bit after erasing the first segment,

    I checked for the ACCVIFG before start the erase for next segment, the bit is never set, which mean everything went okay. Am I correct?

    	for (Temp_Counter=0;Temp_Counter<Loop;Temp_Counter++)
        {
    
            FCTL3 = FWPW;                                               // Clear lock bit
            FCTL1 = FWPW + ERASE;                                       // Password and erase flash enable
    
            *Flash_Pointer_Erase = DUMMY_BYTE;                     //Write dummy byte to erase flash
    
            FCTL1 = FWKEY;                                             // Disable erase flash
            FCTL3 = FWKEY + LOCK;                                      // Set the lock bit
            Flash_Pointer_Erase = Flash_Pointer_Erase - HALF_SEGMENT;   // Decrement to the next segment (512 segment, but for pointers use 512/2)
    
    
        }
    

     3- null pointer issue resolved.


    Thanks, 


  • About your first problem:

    You can't modify the control register without set/reset the UCSWRST. The reason why you can do that, is because when you power on the device, the UCSWRST = 1. It means even if you don't set the UCSWRST, it has been set by the hardware already.

    About your second problem:

    If the ACCVIFG bit is never set, it means everything went okay. What I mean before is that although you don't check busy bit, it may be cleared when you do next operation.

    Eason

  • 2) You didn't say, but I suspect your segment-erase code is running from flash. In that case, the CPU is stalled while the erase is done. [Ref User Guide (SLAU208Q) Sec 7.3.1.4]. As a practical matter, your code will never see BUSY=1.

  • Thanks for clarifying things , appreciate your help. 

  • Yes, it is running from flash, but what confuses me it is required to check it in the erase process either from RAM/Flash.
    [Ref User Guide (SLAU208Q) FIG7.4].

    if the CPU is held what is the purpose of checking the BUSY bit?

    Anyway i will work according to the datasheet , thanks for your help.

**Attention** This is a public forum