MSPM0C1104: EEPROM Emulation migration

Part Number: MSPM0C1104

Tool/software:

Hi,

I'm trying to implement the EEPROM emulation in my project. I try the resource explorer example and works well, but when I want to import the library to my project (adding the paths to the project and including the files), I only get HardFault when I try to initializate the library (EEPROM_TypeA_init).

I have defined the ramfunc attribute in the .cmd file (.TI.ramfunc : load = FLASH, palign(8), run=SRAM, table(BINIT)) also I'm disabling all the interrupts before running the init function.

I don't know what is going on... I need to enable something in the SysCFG?

Best regards,

  • Hi Franco,

    Do you know where in EEPROM_TypeA_init() you Hard Fault? Is there any way you can share your project or files?

    Best,

    Owen

  • I reach the end of the init:
     

    But when return the code crash (attach some information about memory and registers).


  • Hi Franco,

    Thanks for sharing. I was wondering if you could define all interrupts in you main.c file like so:

    void NMI_Handler (void) { while(1) {} }
    void HardFault_Handler (void) { while(1) {} }
    void SVC_Handler (void) { while(1) {} }
    void PendSV_Handler (void) { while(1) {} }
    void SysTick_Handler (void) { while(1) {} }
    void GROUP0_IRQHandler (void) { while(1) {} }
    void GPIOA_IRQHandler (void) { while(1) {} }
    void TIMG8_IRQHandler (void) { while(1) {} }
    void ADC0_IRQHandler (void) { while(1) {} }
    void SPI0_IRQHandler (void)  { while(1) {} }
    void UART0_IRQHandler (void) { while(1) {} }
    void TIMG14_IRQHandler (void) { while(1) {} }
    void TIMA0_IRQHandler (void) { while(1) {} }
    void I2C0_IRQHandler (void) { while(1) {} }
    void DMA_IRQHandler (void) { while(1) {} }

    Best,

    Owen

  • Owen, thanks for the support.

    I was out of the office. Today I try to redefine all the interrupts, but I still locked on HardFault. Also, I disable all interrupts but not succed....

    Best,

    Franco

  • Hi Franco,

    Could you share a screenshot of the Processor Options? You can find this by right-clicking on your project > Properties... > Arm Compiler > Processor Options.

    Best,

    Owen

  • Here is my configuration:

    I checked with eeprom_emulation_type_a_LP_MSPM0C1104_nortos_ticlang example and looks the same.

    Best,

    Franco

  • Hi Franco,

    Yes, that's exactly how we want the settings configured. Is it possible for you to share the project with me? This may make debugging the hard fault easier.

    Best,

    Owen

  • Sure, here is the code:

    CLI_Calibradora.rar

    Best,

    Franco

  • Hi Franco,

    Thanks for sharing. As I looked through the code, I noticed that the EEPROM_EMULATION_ADDRESS defined in the eeprom_emulation_type_a.h file did not match the value in the example. In your code, it was 0x00001000, whereas the example was 0x00001400. I changed it to 0x00001400 and I no longer hard fault. Furthermore, you seem to have multiple #defines for some variables. I would look over these and ensure you are not defining things twice. This may cause some issues.

    Best,

    Owen

  • Owen,

    First of all thanks for the support. Now it's working. 

    Now I have some doubts about the example and the #ifndef inside the library. I test to define the EEPROM_EMULATION_ADDRESS before call the library but it's not work. Also, in the example say:

    #include <ti/eeprom/emulation_type_a/eeprom_emulation_type_a.h>
    #include "ti_msp_dl_config.h"
    
    /* Address in main memory to write to. This is defined in the
     * eeprom_emulation_type_a.h header file. Uncommenting the #define below will
     * overwrite the default #define in the header file. */
    #define EEPROM_EMULATION_ADDRESS    0x00001000

    That isn't true. 

    Best,

    Franco

  • Hi Franco,

    I took another look and realized what the actual issue is. I previously noted the address should be 0x1400. This is incorrect, as I was referencing the Type B macros. The reason why the program hard faults is because the EEPROM emulation address was within the FLASH that your program is in. One way you can check this is by looking at the .map file. Ensure that the emulation address is outside of the code space. The reason why 0x1000 works for the SDK example is because the code in FLASH only takes up to 0xDD0. I believe your program takes up to around 0x1570 in FLASH. I overwrote the address to 0x1600 and I did not experience a hard fault when running the code.

    Hope this provides a better explanation for the hard fault.

    Best,

    Owen