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.

CCS/TMS320F28335: HVPM_Sensorless_2833x abnormal at ADC_cal() when running in FLASH

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hello, my friend, I have met a problem when I run the program 'HVPM_Sensorless_2833x' in FLASH. The program will restart to "codestart" when it meet the function ADC_cal(). However, if the ADC_cal() is commented out, everything is ok.

Here are my configurations:

     1. GPIO84/GPIO85/GPIO86/GPIO87 are all connected to 3.3V;

     2. Using F28335_FLASH_HVPM_Sensorless.cmd;

     3. Add "FLASH" macro in the predefined symbols page of project properties;

     4. CPU Frequency 150MHZ, core voltages are 3.3V and 1.9V;

     5. Watchdog is not used;

Moreover, if I run the program in RAM using F28335_RAM_HVPM_Sensorless.cmd, everything is ok.

  • Step 1. Add the ADC_cal assembly function to your project. The source is included with the Header Files and Peripheral Examples.
    Step 2. Add the .adc_cal section to your linker command file.
    Step 3. Call the ADC_cal function before using the ADC. The ADC clocks must be enabled before making this call.

    And copy Flash setup code to RAM and call the flash wrapper init function to setup correct wait states.
  • Hi Yanming, I have followed all these steps, since the program is provided by TI. Now, I have checked all these steps again, and all these steps have been followed. You give me an irrelevant answer! Pls read my problem again, and give me a big help! Thanks!
  • Could I have your email address. I want to send you my program.
  • You may find the InitFlash() functions in HVPM_Sensorless-DevInit_F2833x.c, and then change the codes as below if you have added ADC_cal() as my last reply. Let me know if you have any further questions. Thanks.

    EALLOW;
    //Enable Flash Pipeline mode to improve performance
    //of code executed from Flash.
    FlashRegs.FOPT.bit.ENPIPE = 1;

    // CAUTION
    //Minimum waitstates required for the flash operating
    //at a given CPU rate must be characterized by TI.
    //Refer to the datasheet for the latest information.

    //Set the Paged Waitstate for the Flash
    FlashRegs.FBANKWAIT.bit.PAGEWAIT = 5; // changed from 3 - ramesh

    //Set the Random Waitstate for the Flash
    FlashRegs.FBANKWAIT.bit.RANDWAIT = 5; // changed from 3 - ramesh

    //Set the Waitstate for the OTP
    FlashRegs.FOTPWAIT.bit.OTPWAIT = 8; // changed from 5 - ramesh

    // CAUTION
    //ONLY THE DEFAULT VALUE FOR THESE 2 REGISTERS SHOULD BE USED
    FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;
    FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;
    EDIS;

    //Force a pipeline flush to ensure that the write to
    //the last register configured occurs before returning.

    asm(" RPT #7 || NOP");
  • Hi Yanming, thank you very much! You have resovled my issue. However, Could you please show me the reason!