TMS320F280049C: Flash Programming of TMS320F280049C via CAN

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Dear Experts,

I'm testing flash programming of TMS320F280049C through CAN boot mode. The reference is sprad51a.

I modified the reference project, "flash_kernel_ex5_dcan_flash_kernel" for TMS320F28003x, as following

[ 1.kernel ]

//===========================================================

<projectSpec>
<project
name="flash_kernel_ex5_280049C_dcan_flash_kernel"
device="TMS320F280049C"
cgtVersion="22.6.1.LTS"
launchWizard="False"
enableHexTool="True"
linkerCommandFile=""
outputFormat="ELF"
postBuildStep="&quot;${CG_TOOL_HEX}&quot; &quot;${BuildArtifactFileName}&quot; -boot -sci8 -a -o &quot;${BuildArtifactFileBaseName}.txt&quot;"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DLIB_INC} -I${BootROM_INC_PATH} -I${FlashAPI_INCLUDE_ROOT} -v28 -ml -mt --define=CPU1 --cla_support=cla2 --float_support=fpu32 --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="-I${FlashAPI_LIB_ROOT} --entry_point code_start --stack_size=0x200 --heap_size=0x100" hexBuildOptions="--boot --sci8 --ascii --outfile=${BuildArtifactFileBaseName}.txt" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../f28004x/driverlib" scope="project"/>
<pathVariable name="C2000WARE_DLIB_INC" path="../../../../f28004x/driverlib/inc" scope="project"/>
<pathVariable name="BootROM_INC_PATH" path="../../../../../libraries/boot_rom/f28004x/rev0/rom_sources/F28004x_ROM/bootROM/include" scope="project"/>
<pathVariable name="FlashAPI_INCLUDE_ROOT" path="../../../../../libraries/flash_api/f28004x/include/FlashAPI" scope="project"/>
<pathVariable name="FlashAPI_LIB_ROOT" path="../../../../../libraries/flash_api/f28004x/lib" scope="project" />
<file action="copy" path="../../../../../libraries/flash_api/f28004x/lib/F021_API_F28004x_EABI.lib" targetDirectory="" />
<file action="copy" path="../../../../../device_support/f28004x/common/include/driverlib.h" targetDirectory="device"/>
<file action="copy" path="../../../../../device_support/f28004x/common/include/device.h" targetDirectory="device"/>
<file action="copy" path="../../../../../device_support/f28004x/common/source/device.c" targetDirectory="device"/>
<file action="copy" path="../../../../../device_support/f28004x/common/targetConfigs/TMS320F280049C.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../device_support/f28004x/common/targetConfigs/TMS320F280049C_LaunchPad.ccxml" targetDirectory="targetConfigs"/>
<file action="copy" path="../../../../../device_support/f28004x/common/cmd/28004x_generic_ram_lnk.cmd" targetDirectory="" />
<file action="link" path="../../../../../driverlib/f28004x/driverlib/ccs/Debug/driverlib.lib" targetDirectory=""/>
<file action="copy" path="../../../../../driverlib/f28004x/driverlib/" targetDirectory="device" excludeFromBuild="True"/>
<file action="copy" path="../../../../../libraries/boot_rom/f28004x/rev0/rom_sources/F28004x_ROM/bootROM/include/cpu1bootrom.h"/>
<file action="copy" path="../../../../../libraries/boot_rom/f28004x/rev0/rom_sources/F28004x_ROM/bootROM/include/cpu1brom_pbist.h"/>
<file action="copy" path="../../../../../libraries/boot_rom/f28004x/rev0/rom_sources/F28004x_ROM/bootROM/include/cpu1brom_utils.h"/>
<file action="copy" path="../../../../../libraries/boot_rom/f28004x/rev0/rom_sources/F28004x_ROM/bootROM/include/bootloader_can_timing.h"/>
<file action="copy" path = "../flash_programming_f28004x.h"/>

<file action="copy" path="../flash_kernel_ex3_codestartbranch.asm" targetDirectory="" />
<file action="copy" path="../flash_kernel_ex5_dcan_flash_kernel.c" targetDirectory=""/>
<file action="copy" path="../flash_kernel_ex5_boot.c" targetDirectory="" />
<file action="copy" path="../DCAN_Boot.c" targetDirectory="" />
<file action="copy" path="../flash_kernel_ex3_commands.h" targetDirectory="" />
</project>
</projectSpec>

//===============================================================================================

[ CANA PIN ]

Boot Mode : 0x42 (CAN_TX - GPIO31, CAN_RX - GPIO30)

Programming OTP for this mode 

[ Flash programmer ]

dcan_flash_programmer.exe and dcan_flash_programmer.sln and PCAN-USB FD

[Test result]

kernel and hex(txt) files were sent to board, but flash memory is not programmed.

What's the check points for this situation?

Sincerely,

Eui-heon

 

  • Hi Eui-heon,

    Is the LED on the PCAN-USB FD blinking red or green while the files are being sent? If red, there is a CAN communication issue.

    After the flash kernel is loaded on the device, try pausing the execution in CCS and loading the symbols associated with the flash kernel (Load dropdown menu -> Load Symbols). Is the flash kernel executing? If so, then that means the CAN boot portion of the project is functioning as expected. If not, you should double-check the physical connections between the host (dcan_flash_programmer.exe) and target (F28004x).

    Kind regards,

    Skyler

  • Dear Skyler,

    When I set the buad rate of CAN with 100kbps in kernel program, the LED of PCAN-USB FD was blinked by RED color. But 1Mbps setting is OK. (Green LED was blinked while data is being transmitted.) I tried debugging and get that the entry address is 0x81592, but flash memory is not programmed. The program context at from address 0x80000 is filled by FFFF. After loading the kernel on the device, try pausing the execution in CCS, the program stopped @

    // DCAN_Boot.c

    while((HWREGH(CANA_BASE + CAN_O_IF2CMD) & CAN_IF2CMD_BUSY) == CAN_IF2CMD_BUSY)
    {


    }

    and I tried debugging as you advised, but I got an error that the symbols could not be loaded.

    I'll check the signal on CAN bus and check other things. Could you please give to me some advices for deugging.

    Sincerely,

    Eui-heon

  • Hi Eui-heon,

    So the LED is blinking green the entire time files are being sent? It looks like your kernel is getting stuck in the DCAN_SendWordData() function, is that correct?

    If so, double check that the GPIOs being configured by the kernel are the ones you expect. The GPIOs are configured according to the bootMode parameter of DCAN_Boot(). 

    Kind regards,

    Skyler

  • Dear Skyler,

    I chaked can data stream using PCAN-USB FD(one more device). I am attaching an image of the result of running the program as following.

    when I execute the dcan_flash_programmer.exe, the kernel is sent to device through "CAN ID : 0x001, data length :2bytes" and "CAN ID : 0x002, data length : 8bytes message shows 80 F2 00 00 00 00 00 00" and trasfer the image of application. While data is being transmitted, the LED on the PCAN flashes green.

    I'm going to do some more debugging.

    Sincerely,

    Eui-heon

  • Dear Skyler,

    I was able to successfully program this by modifying two things.

    Add ALIGN(8) directive in SECTIONS of cmd file and change the output format to eabi. I overlooked the basics.

    Continue to, when checking the operation, the first time programming is possible, but when the power is turned off and on and programming is attempted again, the application does not work. If the flash is erased with the debugger and programming is attempted again, the application works. In this case, which code should be checked?

    Sincerely,

    Eui-heon

  • Hi Eui-heon,

    One thing to check is to perform a memory dump of the re-attempt programming using CCS's Memory browser export functionality. When you say does not work, have the contents of the flash changed from previous dump?

    Thanks,

    Charles

  • Dear Charles Roberson,

    The contextes are same with same file. I tested as following. after writing file A, file B was written, but file A is still saved in memory. From this, it seems like writing only happens once and doesn't happen after that.

    Sincerely,

    Eui-heon

  • Does the kernel text file that's generated have bytes 3 and 4 set to increase the bitrate for application transmission? The DCAN Flash Host programmer requires this edit to submit the application at a higher rate of 1Mbps.

    For example, bytes 3 and 4 should be 0x7AC0 if using the dcan flash host programmer as default.

    Thanks,

    Charles

  • Dear Charles Roberson,

    The problem of not being able to rewrite when the flash memory is written has been solved by changing the sleep time of the PC program from 10ms to 15ms. It seems that this problem can also be solved by erasing the bank and performing the write operation. Thank you for your support.

    My goal is to power up the device, wait for about 5 seconds in CAN boot mode, and then jump to flash memory and run the application when there is no CAN data (signal). I would like to ask for your advice and support on how to implement this feature.

    Since the existing issue has been resolved, should I ask this support request separately?

    Sincerely,

    Eui-heon

  • Hi Eui-Heon,

    Yes, please open a separate thread for this support request.

    Thanks and regards,

    Charles