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/TMS320F28334: Code Composer Studio/TMS320F28334

Part Number: TMS320F28334
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi ,

I am new to Code composer studio and I need help in create project on CCS. I have a output(.out) file of application code and I need to flash this output code to TMS320F28334 controller using UART communication. Could any one please help on this for implementation. 

Thanks & regards,

Jyoti

  •  Working_1.5VFile.txtHi, Sal,

    I hope we have already tried this at our end.

    As you told we are using SCI kernel with echo back communication enabled.

    This you can check from the attached log and terminal screenshot.

    Please send me updated serial_flash_programmer.exe if you have any.??

    and we are more interested to know below queries :

    1. Why checksum is not received from the MCU with not working file ?

    2. Why 2 bytes of change at 6 places is causing above scenario ?

    It would be great if you can schedule a debugging session through webex OR any other online remote session ?

    Regards,

    Bhanu

  • Bhanu,

    The kernel is not doing echo back communication. With the kernel, the host sends a block of data and the device sends a checksum of the block of data after receiving that block of data. This is not echo back. The boot loader uses echo back.

    Please follow my suggestion instead of doing the same thing over and over again. Convert the kernels communication from using checksum to echo back. My last reply was details.

    I cannot tell you why your device is not sending that checksum back. I have tested it and it is working, and i have sent you the exact files I have tested it with which are your files. I also included the serial flash programmer. Please see the ZIP I attached in my previous post.

    sal
  • Hi Sal

    We looked at the code specifically SCI_Boot.c. We didn't find option on how to enable echo back instead of checksum check.
    Can you please tell how to do it?

    Also can you send the code of serail_flash_programmer.exe?

    We have tried with serial_flash_programmer.exe shared by you. Our observations are same. Few files work with it and few don't.

    From code it looks like that unsuccessful return of Flash_Program() can be the reason why checksum is not sent? Why Flash_Program is unsuccessful for that block in non working code? Is Flash_Program already present in 28334 processor? Can the issue be with that for some corner issue?

    Thank you,

    Regards,
    Bhanu
  • Bhanu,

    The SCI_Boot of the boot ROM source code uses echo-back. It is simple and is in the Boot ROM source code. You can do this.

    You already have the source code of the serial flash programmer. It is a Visual Studio project we release in C2000Ware.

    OK.

    OK. This is a good observation. This should have been identified much earlier than this. It may have to do with your board or something else having to do with Flash and not the actual serial flash programming. This may have to do with power, or something else having to do with flash erase and programming.

    I will ask another engineer to respond regarding the flash programming issue.

    In the meantime please confirm it is an issue with the flash programming.

    sal
  • Bhanu,

    When you execute Flash_Program() function, what error message are you getting? Did you already make sure that the flash addresses you are trying to program is in erase state to begin with.

    Flash_Program() function doesn't care about checksum. Flash_Program() function is available as part of Flash28335_API_V210.lib. It is not inherently present in F28334 device.

    Regards,
    Manoj
  • Hi, Sal,

    We are using the current f28335_flash_kernel project with only minor changes of  (Device selection –f28334 and clock selection – 30Mhz).

    “The SCI_Boot of the boot ROM source code uses echo-back.” Are you talking about SCI_boot.c? We checked at SCI_boot.c and looked at function CopyData(). It is writing 1K data at a time to flash.

    Regarding echo back option, can you be specific :

    1. If any other  file has to be added in the project?

    2. What change needs to be made in which file for echo option?

    We build serial_flash_programmer using "f05_DownloadImage.cpp" that is available in the C2000ware installation folde. It is not working properly. Please check the attached screenshot image for your reference.

    This is not the case with serial_flash_programmer.exe shared by you.We are able to download few files. So request you to share the source code from where you generated serial_flash_programmer.

    Regards,

    Bhanu

    Hi Manoj,

    We are not getting any error messages.

    We are able to successfully download few files to flash. There are few files which are  getting struck after 70% download. We captured serial data transmitted between host and device. We saw that checksum was not getting sent for those files from the device. We looked at code CopyDAta() in Shared_Boot.c and saw that only condition when checksum is not getting send is Flash_Program() doesn’t return success. So we reached to conclusion that perhaps Flash_Program is not successful.

    ---------------------------------------------------------------------------------------------

    status = Flash_Program((Uint16 *) BlockHeader.DestAddr,

                                      (Uint16 *)progBuf, BlockHeader.BlockSize,

                                      &FlashStatus);

               if(status != STATUS_SUCCESS)

               {

                   return ;

               }

               //

               // After Flash program, send the checksum to PC program.

               //

               SendCheckSum();

    ------------------------------------------------------------------------------------------------

    We wonder why flash program is not successful after loading 70% of code? Why it is successful for few files and unsuccessful for few others? The difference between successful and unsuccessful file is minimal. And only after loading the block, where the difference is there, we see checksum not coming from the device.

    PFA : screenshot of working & not working serial dumps

    Thanks

    Bhanu

  • Bhanu,

    First, the echo back can be found in F05_DownloadKernel.cpp (host) and SCI_Boot.c (device) here: C:\ti\c2000\C2000Ware_1_00_06_00\libraries\boot_rom\f2833x\v2_0\rom_sources\source

    The only change I may have made to F05_DownloadImage.cpp may have been to increase the delay in the Sleep() functions in the Visual Studio project. Try this.

    Please provide Manoj with the return value with Flash Program does not succeed. The function returns a failure status. What is that status?

    sal
  • Hi Sal,

    "First, the echo back can be found in F05_DownloadKernel.cpp (host) and SCI_Boot.c (device) here" (we could not find this file - F05_DownloadKernel.cpp)

    We are using already using SCI_Boot.c as you mentioned. So what change has to be made for echo_back..?

    We have tried by putting some delay(sleep 10000) after kernel loaded, It doesn't help in resolving the download issue.. This is not the case with serial_flash_programmer.exe shared by you. We are able to download a few files. So request you to share the source code from where you generated serial_flash_programmer. It seems to have other changes apart from delay e.g kernel download is echoed back to terminal.

    We looked at code CopyDAta() in Shared_Boot.c and saw that only condition when checksum is not getting send is Flash_Program() doesn’t return success. So we reached to a conclusion that perhaps Flash_Program is not successful.  We could not see the return value of Flash_Program as it is connected via USB UART

    Regards,

    Bhanu

  • You are correct. I mistakenly mentioned f05_DownloadKernel. Attached is the source.

    The SCI_Boot.c and Shared_Boot.c I pointed you to in C2000Ware from Boot ROM is different code from the SCI_Boot.c in and Shared_Boot.c that the kernel uses.

    Please look at the boot ROM source code to see how echoback is implemented.

    Please determine the error code that Flash Program is returning. This is important for debugging.

    sal
  • See attached source code.

    sal

    e2e.zip

  • 4530.f05_DownloadImage.cppHi Sal,

    We looked into the code (SCI_Boot.c and Shared_Boot.c) from your recommended path. We used these to generate Kernel and we have tested this kernel. We observed echoing back happening for the application file. Entire application gets loaded. Please see screenshot. But it seems it is not getting executed.

    We think that downloaded application is not getting loaded to flash.  What program was supposed to do is not happening.

    Also we observed in the CopyData() function from Shared_Boot.c ( rom_source folder )  ,  flash_erase & flash_program are not getting called and including of "Flash2833x_API_Library.h" is missing. They are present in file that kernel uses.

    We can not determine the return value of Flash_Program, as it is connected via USB UART. ( please guide us how to debug this further?)

    Regards,

    Bhanu

  • Bhanu,

    The existing code from Boot ROM does not use flash erase and program. You need to integrate the two solutions now. Use the flash erase and flash program from the original kernel with the communication (echo-back) from the boot loader.

    I am glad you got the communication working. Now integrate the flash API.

    sal
  • SCI_boot_shared_boot.zipHi Sal  & Manoj,

    We have integrated two solutions and compiled Kernel file that enables echo back of application image and flashes the program.(check attached modified SCI_boot.c and Shared_boot.c for your reference)

    We observed the same behaviour. Few files are working & few files are not working . Behavior is exactly same as before. Not working file stops at same location as before. Check the attached screenshot.

    Also we checked "Flash_Program" status,   when application load halts. It is returning (1F) that means error code : 31.

    (error: STATUS_FAIL_ZERO_BIT_ERROR)

    Can you help us in understanding  STATUS_FAIL_ZERO_BIT_ERROR error and resolving it?

    Does Flash28334_Program(a,b,c,d) has some issue, which gets reflected with certain block of data?

    Regards,

    Bhanu

  • Manoj,

    Can you comment on this?

    Bhanu,
    Are you observing this on multiple boards?

    sal
  • Bhanu,

    The flash API error conditions are documented in the flash API documentation which is located in the following C2000Ware directory:

    C2000Ware\libraries\flash_api\f2833x\28335\docs\Flash2833x_API_Quickstart.pdf

    Flash_Program function gives STATUS_FAIL_ZERO_BIT_ERROR when the data to be programmed has '1' in it and that flash address is already programmed to '0'. For example, if you program a location with 0x0001 and then try to program the same location with 0x0002 the function will return this failure. This is because no single bit can be erased (i.e. moved from a 0 to a 1). If this happens, the
    function will not attempt to program any other bits.

    Regards,
    Manoj
  • Bhanu,

    In light of what Manoj mentioned, please make sure the that the flash you are programming has been erased properly. Also, please try this on multiple boards.

    sal
  • Hi Manoj & Sal,

    We are using CopyData() function of Shared_Boot.c from where Flash_Erase and Flash_Program functions are called. If this function works for F82335 for files( working and not working files of F82334) then only suspect lies with  Flash_28334Erase and Flash_28334Program.

    Can you please look at the code your end and tell what could be causing this issue? I am attaching the file.

    As told before, we are able to successfully download some files. The files which are  not downloaded successfully have some very minor difference in the file contents.

       a. Both files are having the same size and only few bytes are differs (ex: 0x0800 /0x555 in the working file & 0x0FFF in the not working)

       b. Code is stopping at this block where there is a difference.

       c.   Check attached comparison screenshot of working & NotWorking files.

    We have same observation on testing with 3-4 boards.

    We need your help to –

     1. Relook at code your end and tell what could be causing this issue?

     2. Why flash erase/ flash program is not happening properly only for the block that has 0xFFF in it? Why it is becoming evident for only block that has “0x0FFF” in the file.

     3.  Do you think that internal Flash of this part has some issue, which  is leading to this issue to come up?

    Awaiting for your reply.

    Regards,

    Bhanu

    5736.SCI_boot_shared_boot.zip

  • Hi, Manoj & Sal,

    Awaiting for your reply and resolution.

    Thank you,

    Regards,

    Bhanu

  • Bhanu,

    I would not suspect Flash API files for this problem. These Flash API files have been used successfully without issues for more than 15+ years.

    As I mentioned before, If the Flash_Program functions is failing "STATUS_FAIL_ZERO_BIT_ERROR". You need to first erase that sector before programming it.

    Regards,
    Manoj
  • Hi, Manoj,

    As I have mentioned before, we are following the same procedure and kernel file for both working & Not working files.

    Also both files are having same file size, having only few bytes differs as shown in the earlier screenshot.

    Why flash erase/ flash program is not happening properly only for the block that has 0xFFF in it? Why it is becoming evident for only block that has “0x0FFF” in the file.

    Please tell us how to debug further ?

    Regards,

    Bhanu

  • Bhanu,

    I know you had issues with flash program. But, I didn't realize you had problem with flash erase? What error message do you receive when you run flash erase algorithm? If anything flash erase algorithm is independent of hex file. So you shouldn't have any issues erasing a sector?

    This is an extremely long thread. I'm not privy to whole problem you are facing. I need to align with other engineer who had been working with you before I stepped in. Please give 5 business days to get back with you with some debug tips.

    Regards,
    Manoj
  • Hi Manoj,

    Greetings for the day!

    Thank you very much for your support. To proceed much progressively, let me give you a clear picture on it.

    In our application,

    1. DAC output has to be the value as per the configuration in the application file. For an example, if application configures DAC as 1V, then after loading this application we expect DAC output as 1V. This DAC output configuration range will be from 0V to 3.3V

    2. When the application configures DAC output is 0V to 1.5V, the output file generated by the TI tool is successful in loading into the flash.

    3. When the DAC output is configured 1.5V to 3.3, the output file generated by the TI tool is unable to load into the flash.

    For your information,

    If the output file format is .hex file, for DAC output 0V to 3.3V, it is loading into the flash successfully. But, if the output file format is .txt file, the output file is loading successfully for DAC output 0V to 1.5V and if the DAC output is 1.5V to 3.3V, the output file is not loading into the flash successfully.

     

    For flashing both output file formats .hex and .txt we are using the same Erase Algorithm.

     

    Could you please help us in understanding the problem? Is it with conversion tool? We had this doubt because, .hex file output format is able to load successfully but not with .txt file format.

    Regards,

    Rajkumar

  • Rajkumar / Bhanu,

    Please answer the question I have asked before. I can't provide your meaningful inputs until you followup by answering the question I have asked in previous post.

    Regards,
    Manoj
  • Hi manoj,

    "0x1f" is the error what we are encountering in erasing the flash. we have explained you the application requirement in order to give you a clear picture of the issue. We are extremely sorry if the given info is overloading you in understanding the exact issue. 

    Thanks,

    Rajkumar 

  • Rajkumar,

    Error # 0x1F (31 decimal) corresponds to error message when Flash_Program function and NOT Flash_Erase function. I had explained in earlier posts what this error means.

    Regards,
    Manoj
  • Hi Manoj,

    We observed STATUS_FAIL_ZERO_BIT_ERROR, when file download is unsuccessful. This error occurs when the bit is not properly erased before writing. From this we conclude that flash erase is not occurring properly. Its the same tool through which we are able to download few files(DAC required output voltage 1.0V, 1.2V, 1.5V,) and are unsuccessful in some (DAC required output voltage greater than 1.5 V)

    There is minor between difference between successful and unsuccessful file. Only below hex content is different at 8 location.

    DAC Required Output Voltage

    Hex Value

    Binary Value

    1.0 V

    0x0555

    0000 0101 0101 0101

    1.2V

    0x0666

    0000 0110 0110 0110

    1.5V

    0x0800

    0000 1000 0000 0000 

    3.3V

    0x0FFF

    0000 1111 1111 1111

     When the block containing this different is transferred the flash program thows the error.

    Could you please tell why flash erase is unsuccessful, which is leading to STATUS_FAIL_ZERO_BIT_ERROR error from Flash program?

    Thank you.

    -Rajkumar

  • Hi Rajjumar,

    I will let Manoj comment on the flash issue.

    I have one follow up question... When you are getting this error, is the block in fact not programmed correctly? The the error message correspond to a true programming error? Or is the data programmed correctly although it is returning an error?

    sal
  •  

    Hi Sal,

    We added Flash_Verify() in the CopyData() function in shared_Boot.c, when Flash_Program() returns error. See below code. We observed Flash_Verify function returns 0x28 value. This is for STATUS_FAIL_VERIFY error. This happens for the block,where difference in bytes is there for working and non working block.

    Flash_Program() returns STATUS_FAIL_ZERO_BIT_ERROR. This error is returned by Flash_Program() when Flash has not been erased properly.

    Can you please expedite in identifying the root cause of this behavior? We can have a webex session for debugging.

    //

    // Program as many full buffers as possible
    //
    for(j = 0; j < (BlockHeader.BlockSize / PROG_BUFFER_LENGTH); j++)
    {
    BlockHeader.ProgBuffAddr = (Uint32)progBuf;
    for(i = 1; i <= PROG_BUFFER_LENGTH; i++)
    {
    wordData = (*GetOnlyWordData)();
    *(Uint16 *)BlockHeader.ProgBuffAddr++ = wordData;
    }
    status = Flash_Program((Uint16 *) BlockHeader.DestAddr,
    (Uint16 *)progBuf, PROG_BUFFER_LENGTH,
    &FlashStatus);
    if(status != STATUS_SUCCESS)
    {
    check=1;
    check = Flash_Verify((Uint16 *) BlockHeader.DestAddr, // for debug
    (Uint16 *)progBuf, PROG_BUFFER_LENGTH,
    &FlashStatus);
    SendFlashNotSuccessValue(status, check);
    return ;
    }
    BlockHeader.DestAddr += PROG_BUFFER_LENGTH;

    //
    // After Flash program, send the checksum to PC program.
    //
    //SendCheckSum();
    }

    Thanks

    -Rajkumar

     

     

  • Manoj will have to comment further regarding the flash API.

    But, how many devices have you tested this on? Are you able to reproduce this issue deterministically on other device as well? Meaning, does it always fail on all devices in the same exact way which can be predicted?

    sal
  • Hi Sal,

    We have tested this in 3 devices and it is reproduced in all 3 boards. All the 3 boards failed in the same way throwing same error.

    Could you please help us in resolving this issue and  we are awaiting Manoj's reply on Flash API.

    Thank you.

    -Rajkumar

  • Jyothi,

    Flash Error : STATUS_FAIL_ZERO_BIT_ERROR happens when you try to program a bit location with '1' when that bit location already has '0' programmed in it. If flash program function reports this error, I would read the address locations you are programming and make sure the flash address locations you are trying to program has 0xFFFFs (erased state).

    Regards,
    Manoj
  • Hi Manoj

    Since STATUS_FAIL_ZERO_BIT_ERROR  occurs, we were doubting the Flash_Erase() function from start only.

    We verified the Flash block,  where we were writing to check whether it has 0xFFFF. We saw Flash_Verify returning 40.

    why Flash_erase() is not successful?

    How exactly the Flash_Erase() works ?

    where can we find the code of it ?

    I searched for the size of SECTOR A, SECTOR B, SECTOR C, SECTOR D but i found 

    #define SECTORA (Uint16)0x0001
    #define SECTORB (Uint16)0x0002
    #define SECTORC (Uint16)0x0004
    #define SECTORD (Uint16)0x0008
    #define SECTORE (Uint16)0x0010
    #define SECTORF (Uint16)0x0020
    #define SECTORG (Uint16)0x0040
    #define SECTORH (Uint16)0x0080

    where can we find the size of SECTOR ?

    Could you please help in resolving the issue ?

    Thank you.

    Rajkumar

  • Rajkumar / Jyoti,

    Problem resolution: Application that was getting programmed in flash was using Sector H / G. But, serial flash programmer software wasn't erasing Sector E / F / G / H before trying to program the new application code that is the reason customer was getting "STATUS_FAIL_ZERO_BIT_ERROR". By modifying the serial flash programmer software to erase Sector E. F, G, H we were able to resolve this issue.

    We consider this issue resolved.

    Regards,
    Manoj