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.

TMS320F28388D: Problem CPU2 program running from Flash

Part Number: TMS320F28388D

Hello,

I've a problem related to running my program on CPU2 from Flash on a TMS320F28388D. 

My project is a multicore project. And my program is running well when it's running from RAM. But when running from Flash, it's like I don't control the GPIO on CPU2.

The flow of CPU1 is:

- InitSysCtrl

- BootCPU2 from Flash

- Initialize CPU1 (PIE VECT, GPIO,...)

- Tell CPU2 to initialize using IPC and wait for CPU2 to end its initialization

The flow of CPU2 is:

- wait CPU1 notification to start initialization

- initialize (PIE VECT / CLA / DMA) and tell CPU1 that initialiszation is ended using IPC

When I run my program on CPU2 from RAM, I can see IO DEBUG 6 Blinking but when I run it from FLASH, it's not running as I don't see the LED Blinking. It's like I don't control the GPIO. But I correctly manage ownership of GPIO in the ConfigGpio() function.

Note that DMA is transferring datas from CLA.CPU2 memory to GS15. And datas are correct so this part of the program is running well from Flash.

I attach the two main.c of CPU1 & CPU2.

Any idea to solve my problem ? (I send you a message because I'm unable to post it on the forum).

Thank you,

Adrien

main_cpu01.c 

main_cpu02.c 

 

  • Hi,

    Can you please confirm if your code is getting loaded in Flash? Can you check your map file and confirm?

    Regards,

    Rajeshwary

  • Hi Rajeshwary,

    I've just checked the .map file and the program of CPU2 is loaded in Flash. It starts at 0x80002 (Flash 1) and its length is 0xca7.

    When I put it in RAM, I don't have any problem.

    I have a piece of program than run on CPU2.CLA and uses DMA to transfer data to CPU1 and this is working well even if the program is in Flash.

    The problem seems only to affect CPU2. On CPU2, I make a LED blinking and I use I2C module => running well when it's in RAM but not when it's in Flash.

    It seems like when I boot CPU2 from Flash, the configuration of GPIO and I2C module is overwritten. But in my initialization sequence I use flags of IPC module to synchronize both cores and I follow the procedure.

    Thanks for any more suggestions,

    Regards,

    Adrien

  • Hi, 

    Your code is correctly getting loaded , problem is when you try to execute or debug the code. Is my understanding is correct?

    Regards,

    Rajeshwary

  • Hi,

    Right, it's correctly loaded.

    The problem is when I execute the code from Flash => it corresponds to "Standalone Boot Flow" (figure 5.3 TRM).

    I'm thinking about 2 possible issues:

    • program of CPU2 is not launching correctly when executing from Flash
    • program of CPU2 is launching but

    I have the following booting process:

    • CPU1 starts from Flash adress 0x080000 as booting pins GPIO72 = 1 & GPIO84 = 1
    • it executes codestart section (generic file f2838x_codestartbranch.asm) and branch to generic function _c_int00 that call main function
    • Main of CPU1 => I call the generic function InitSysCtrl() to initialize Flash, PLLs...)
    • Then I boot CPU2
      • configure CPU1TOCPU2IPCBOOTMODE to BOOT_TO_FLASH_SECTOR0 (so adress 0x080000 where the codestart section resides)
      • set IPCFLG0 so that CPU2 branch to application

    In the main of CPU2, I make la LED blinking and it's not blinking.

    I don't have this problem when I use the debbuger and I do the following process:

    • launch debug session so CPU1 stops at first instruction of main()
    • connect CPU2
    • load program in RAM of CPU2
    • executes CPU2 (so program on CPU2 is running but is waiting for CPU1 to Setup as I use IPC flags to sequence booting process of both cores)
    • and then executes CPU1
    • => I can see the LED- manage by CPU2 blinking

    Regards,

    Adrien

  • More details in the reflexion:

    • CPU2.CLA and CPU2.DMA are working well when booting from Flash without the debugger. It means the booting process is correct and processor CPU2 executes the main program. Otherwise, it wouldn't work. So I think the problem is more about the configuration of peripherals.

    If you look at main_cpu02.c of my first post. Maybe, configuration of Timer1 is overwritten or something like this.

    Are the timers shared between the two cores ? I'll try just to toggle a GPIO to be sure it doesn't come from the timer.

    Adrien

  • Ok I've just fixed the issue. 

    In my program, at the end of the initialization of CPU2, CPU2 set a flag IPC and wait for this flag to be effectively one using a while(!Cpu2toCpu1IpcRegs.CPU2TOCPU1IPCFLG.bit.IPCx).

    On the other side, CPU1 wait for the end of initialization of CPU2 by doing while(!Cpu1toCpu2IpcRegs.CPU2TOCPU1IPCSTS.bit.IPCx) and when this status is set, it acknowledges doing Cpu1toCpu2IpcRegs.CPU1TOCPU2IPCACK.bit.IPCx and the flag is cleared on the side of CPU2.

    CPU1 was too fast to acknoledge the flag and CPU2 was blocking in the while(!Cpu2toCpu1IpcRegs.CPU2TOCPU1IPCFLG.bit.IPCx).

    To fix it, i just add a delay after while(!Cpu1toCpu2IpcRegs.CPU2TOCPU1IPCSTS.bit.IPCx)  to let CPU2 getting of the while(!Cpu2toCpu1IpcRegs.CPU2TOCPU1IPCFLG.bit.IPCx).

    Now, it's working well. I don't know why but when I was using the debugger and doing the same thing in RAM, I didn't see that problem.

    Thanks for your help,

    Adrien