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.

TMS570LS3137: SPI Bootloader

Part Number: TMS570LS3137

Tool/software:

Hello,

Im trying to flash the microcontroler via SPI, (from a conected external memory).

Using the application notes provided:

SPI Bootloader for Hercules TMS570LS31X MCU (ti.com) 


I have moodified this function to flash from the data reead in the external memories and not as packets recived via SPI,
however im having a issue with the function Fapi_BlockProgram. 

Im getting 


CortexR4: Trouble Reading Memory Block at 0x800243c on Page 0 of Length 0x3c
CortexR4: Trouble Reading Memory Block at 0x8002464 on Page 0 of Length 0x24
CortexR4: Can't Single Step Target Program: (Error -1066 @ 0x8002468) Unable to set/clear requested breakpoint. Verify that the breakpoint address is in valid memory. (Emulation package 9.4.0.00129)
CortexR4: Can't Run Target CPU: (Error -1066 @ 0x8002468) Unable to set/clear requested breakpoint. Verify that the breakpoint address is in valid memory. (Emulation package 9.4.0.00129)

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* bl_spi.c */
#define PAGE_LENGTH 16
void readExtMem(uint8_t FRAM, uint32_t packetNr, uint32_t dataDir, uint8_t *returnDir);
uint16_t rExtMem(uint32_t address, uint8_t cs, bool delay);
void cast8to32(uint8_t *dataIn, uint32_t *dataOut){
uint8_t littleEndian = 0;
if (littleEndian){
*dataOut = ((uint32_t)dataIn[3] << 24) |
((uint32_t)dataIn[2] << 16) |
((uint32_t)dataIn[1] << 8) |
((uint32_t)dataIn[0]);
} else {
*dataOut = ((uint32_t)dataIn[0] << 24) |
((uint32_t)dataIn[1] << 16) |
((uint32_t)dataIn[2] << 8) |
((uint32_t)dataIn[3]);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* bl_flash.c */
uint32_t Fapi_BlockProgram( uint32_t Bank, uint32_t Flash_Address, uint32_t Data_Address, uint32_t SizeInBytes)
{
register uint32_t src = Data_Address;
register uint32_t dst = Flash_Address;
uint32_t bytes;
if (SizeInBytes < 16)
bytes = SizeInBytes;
else
bytes = 16;
if ((Fapi_initializeFlashBanks((uint32_t)SYS_CLK_FREQ)) == Fapi_Status_Success){
(void)Fapi_setActiveFlashBank((Fapi_FlashBankType)Bank);
(void)Fapi_enableMainBankSectors(0xFFFF); /* used for API 2.01*/
}else {
return (1);
}
//Here the program gets stucked
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Marco,

    I verified the above shared code and i don't see any issues in it.

    I need your complete project, is it possible to share it? You can send through a private message also if needed.

    And also, i would like to know what your external memory is here?

    How are you getting data to the FRAM1 array? Are you reading through SPI protocol only or you are using EMIF?

    --
    Thanks & regards,
    Jagadish.

  • Hi Marco,

    Thank you for sharing codes, i will look into them and update my inputs soon.

    --
    Thanks & Regards,
    Jagadish.

  • Hi Marco,

    I verified your code, may be the following thing is the issue:

    Your application start address is 0x180000 right, which is nothing but a flash bank-1.

    But while you are calling Fapi_BlockProgram function you are calling with bank-0.

    If we do this flash bank-0 will get activated for writing but we are actually trying to write to the bank-1. So please pass bank-1(1) value to the Fapi_BlockProgram  API to write at address 0x180000.

    --
    Thanks & regards,
    Jagadish.