MPC5748G-LCEVB How to debug_flash based on SDK sample codes.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5748G-LCEVB How to debug_flash based on SDK sample codes.

1,738 Views
junehsiao
Contributor I

Dear all,

I have a MPC5748G-LCEVB board, and I wrote a very simple SDK-based code on S32DS which after running it, one of the LEDs on the board will start blinking every 0.5 seconds.

This code works well when I connect the board to my computer with JTAG, then choose the debug_RAM in build code (hammer icon), then choose the debug_RAM file in Debug Configuration (green bug icon), then press the "play" button.

But I want the code to run even after switching off and then on the power of the evaluation board. Therefore, after choosing the debug_FLASH in build code (hammer icon), then choosing the debug_FLASH file in Debug Configuration (green bug icon), and press the "play" button, the code ran well (LED is blinking), too.

However, after turning off the power of the board and then turning it back on, the LED on the board stops blinking, which I supposed the code have been erased. I thought after burning the code in debug_FLASH mode means even if the power of the board is off then on, the code will still run (the LED will still blink).

Since I am a beginner here, is there a step by step tutortial on how to burn code into the board and still works after turning off the power and back on?

 

BRs,

June Hsiao

0 Kudos
19 Replies

1,695 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

1. How to know if my software is loaded in flash or not?

You can simply use debugger and look at your flash content. If it is programmed and you do power on reset, you will see your binary there.

2. For initializing the things you said (RAM ECC, SWT, etc...), do I need to add some code or can I just initialize them on "Build Code" or "Debug Configuration" button?

Hmm, not sure what do you mean. The init is usually part of the startup code. Whether it comes from third party (like NXP startups are in the sample projects, or new projects wizards) or it is written by you.

Flash target sample projects from S32DS will run by defaults with all startups init.

Best regards,

Peter

0 Kudos

1,663 Views
junehsiao
Contributor I

Hi Peter,

The following attachment is my BlinkingLED code.

I followed the steps from this link:

https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/HOWTO-Create-a-Blinking-LED-Project-MP...

The only change is that in step 30, I select "Debug" in build code rather than "Debug_RAM".

And as for the Debug Configuration, the below picture is my configuration.

346114550_1223887308266016_2489130697643259255_n.jpg

Then, after pressing debug, the LED blinked successfully.

However, after a power reset, the LED stopped blinking.

Do you know what the problem might be?

BRs,

June

0 Kudos

1,642 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

I just loaded your project.

Your code is still RAM target:

petervlna_0-1684309255218.png

In other words, your code is in RAM. So if you reset the device RAM content is lost.

Your flash is empty:

petervlna_1-1684309326336.png

When you creating a project make sure your target is Flash.

I have a feeling you should take some basic trainings on microcotntrollers as this device is quite complex and will require good understanding of IPs.

Have a look at trainings available for S32DS, and also SPC5748G.

Best regards,

Peter

 

 

0 Kudos

1,631 Views
junehsiao
Contributor I

Hi Peter,

After looking at this link:

https://community.nxp.com/t5/MPC5xxx/MPC5748G-flash-start-address-flashStart-1000000/m-p/821300/thre...

I modified linker_flash.ld to :

MEMORY {
flash_rchw : org = 0x00F90000, len = 0x4
cpu0_reset_vec : org = 0x00F90000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00F90000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00F90000+0x04, len = 0x4

m_text : org = 0x00F94000, len = FLASH_SIZE
m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE
}

The MPC5748G's NVM memory map is attached.

After burn code, the memory is:

3c10aaa1-d753-4b2c-8826-baf49dbae87f.jpeg

1ae9cbdc-00bf-4772-91c5-aaa16ecab3d6.jpeg

Which seems like it has successfully burn into FLASH.

But after power reset, LED is still not blinking.
 
 
June
0 Kudos

1,591 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Well, I do see some data in your flash, however those are not a valid RCHW.

So no boot from this location 0xF94000 is made in your project.

Your RCHW is probably at 0x00F90000. Not sure what is the content of address with 0x10 offset, but there should be your start as you present on linker.

flash_rchw : org = 0x00F90000, len = 0x4
cpu0_reset_vec : org = 0x00F90000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00F90000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00F90000+0x04, len = 0x4

petervlna_0-1684395105014.png

petervlna_1-1684395146784.png

Best regards,

Peter

0 Kudos

1,568 Views
junehsiao
Contributor I

Hi Peter,

Do you mean my address is configured wrong?

But from the link I gave you on my previous reply, a NXP Employee said the config is correct for MPC5748G.

Screenshot from 2023-05-19 12-20-35.png

So which two address for reset and m_text do you suggest?

 

June

0 Kudos

1,554 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

This is unknown to me.

What you need to do is to set correctly CPU reset vector to point to your startup code.

So make sure you have valid RCHW and CPU0 reset vector points your startup code.

Thats all needed for correct boot from flash.

Once you see your device after reset jump from BAF to the address in CPU0 reset vector, you are set up and you can execute your code from that address.

petervlna_0-1684480832640.png

Best regards,

Peter

0 Kudos

1,528 Views
junehsiao
Contributor I

Dear Peter,

The board I bought is NXP MPC5748G-LCEVB (https://www.nxp.com/design/development-boards/automotive-development-platforms/mpc57xx-mcu-platforms...).

And my development tool is S32DS for Power Architecture IDE(https://www.nxp.com/design/software/development-software/s32-design-studio-ide/s32-design-studio-for... ) that NXP suggested to use.

I ran the hello world example project from S32DS SDK, but after many tries, still couldn’t burn FLASH code to the board.

I would like to ask if you can give a simple sample project that can correctly burn FLASH code to MPC5748G-LCEVB?

Thanks.

BRs,

June

 

 

0 Kudos

1,477 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Ok, I have created simple example from S32DS examples:

petervlna_0-1684739607680.png

By default it is set to build from flash.

petervlna_1-1684741506458.png

So when I compile the project I can see the boot addresses:

petervlna_2-1684741549714.png

After I burn it to the micro, I can see the RCHW is valid and it is on the place it should be (in flash).

petervlna_3-1684741619476.png

Everything is just working with default settings.

I have attached for you the project as well.

Simply load the elf to the device and you are done.

Best regards,

Peter

 

 

0 Kudos

1,427 Views
junehsiao
Contributor I

Hi Peter,

I followed your instructions, and got the same result as you did.

349079149_564090649233293_2941788569189195415_n.png

346168843_907825633661118_1129064753643655560_n.png

After burn code and run code, one LED light up (which is correct).

But after a power reset (switch SW2 off then on), the LED light disappear.

Can your board still runs the code after a power reset? I would like to ask what board did you use.

My code is in the attachment.

BRs,

June

0 Kudos

1,321 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Just tested your code for z4_1. It boot correctly from address 0x0100 0000.

After power on reset or any kind of reset.

If any LED you have in code works, I do not know as I use X-MPC574XG EVB board.

This is an application issue rather the micro one.

What comes to my mind is that you have some remnants of code in your micro, like previous Boot address on address lower then 0xFA0000. Check the micro for these addresses.

petervlna_0-1685342949477.png

Check also there is your start address after power on reset. If the micro jumps to 0x0100 0000 address like I see in your code tests here:

petervlna_1-1685343036943.png

Best regards,

Peter

0 Kudos

1,308 Views
junehsiao
Contributor I

Dear Peter,

Do you know how to earse previous Boot address on address lower then 0xFA0000?

Should I erase them by adding code to my project? Or configure something on "Debug Configuration panel" in S32DS? Or there is a correct way to erase them?

BRs,

June

0 Kudos

1,275 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Do you know how to earse previous Boot address on address lower then 0xFA0000?

Yes. You can for example use nexusPPC from PEMicro web pages.

Or you can use S32DS to load empty binary to device:

https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/HOWTO-MPC5777C-Low-Mid-Flash-block-era...

But first check if there are any RCHW on bootable addresses. If there are none, then it makes no sense to erase it.

You must be able to see where the code boots. I can see your code here on my sample boots at 0x0100 000 address. Do you see the same?

Best regards,

Peter

0 Kudos

1,270 Views
junehsiao
Contributor I

Hi Peter,

From your reply, does RCHW mean 005Ah in the first halfword?

In my case, my target boot header is FA0000h but I also got a 005Ah in F8C000h.

download.jpg

Screenshot from 2023-05-30 15-02-40.png

So that's why I wanted to ask how to erase the incorrect boot header in F8C000h.

Also, in your reply, the link is for MPC5777C,  do you have the mpc5777c_low_mid_empty.srec file for MPC5748G?

June

0 Kudos

1,239 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

From your reply, does RCHW mean 005Ah in the first halfword?

Yes. So your issue is that you do not erase whole flash, and the remnants of previous boot header are still there.

Also, in your reply, the link is for MPC5777C,  do you have the mpc5777c_low_mid_empty.srec file for MPC5748G?

No, I don;t. you have to create it by yourself. Simple create empty s-record with any tool you like.

petervlna_0-1685514384807.png

 

But, I expect for you would be much easier just to use nexusPPC SW from PEMicro, where erase of flash is available directly.

Best regards,

Peter

0 Kudos

1,158 Views
junehsiao
Contributor I

Hi, 

I am using nexusPPC SW from PEMicro to erase flash, but encounter a problem:

1685454031507.png

I turned off the power of the board, and then simultaneously turn on the power and press "OK" button.

But this message still pops up, saying the board is not connected.

I saw the answer to my question is pressing "OK" button after power on and before reset red LED light up.

But in my case,  after powering up the board, the reset red light immediately light up.

So is it impossible to connect the board to nexusPPC SW?

0 Kudos

1,141 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

If you power board is the reset light always on?

Or only reset escalation message is present on debug interface?

I am not sure here as I never used nexusPPC.

To exclude reset escalation please measure the reset line via scope right after power on reset, you will see 15 consecutive resets in time of 300ms. (20ms each). If you see that, then your micro has SW which is not serving SWT.

I turned off the power of the board, and then simultaneously turn on the power and press "OK" button.

When I used this kind of method with Lauterbach in past, I had to repeat **bleep** multiple times, in order to connect to device within 300ms so the debugger can stop SWT.

Best regards,

Peter

0 Kudos

1,712 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Did you verify your SW is loaded in flash?

Once you have it in flash it is running after power on reset. There is no issue.

What comes to my mind is that you SW is not proper and will hang out somewhere in executions. But it will definitely run.

have in mind that debugger initialize different things, for example RAM ECC, SWT, etc...

If you are missing those in your SW then after power on reset it will end up in some exception of endless loop.

Have a look at out HOW TO guides:

https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/S32DS-list-of-HOWTOs/ta-p/1113475

Best regards,

Peter

0 Kudos

1,708 Views
junehsiao
Contributor I

Hi Peter,

Thank you for your quick reply.

There are still some questions that came up to me:

1. How to know if my software is loaded in flash or not?

2. For initializing the things you said (RAM ECC, SWT, etc...), do I need to add some code or can I just initialize them on "Build Code" or "Debug Configuration" button?

Unfortunately after looking into the HOW TO guides, I still couldn't find guides for flashing codes for MPC5748G-LCEVB.

BRs,

June

0 Kudos