[MPC5748G] How to use FlexCAN in Pretended Network Mode

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

[MPC5748G] How to use FlexCAN in Pretended Network Mode

2,972 Views
webbersun
Contributor III

Hi,

     I had issue of Pretended Networking mode for FlexCAN0. I modified NXP wedsite's project as the hello_pll_interrupt-flash.gpi of AN4830. I want to  implement that system exit STOP mode to enter RUNx mode with FlexCAN,but it can't work as well. Could help to check attached file.

Original Attachment has been moved to: MPC5748G_rev1_silicon.7z.zip

Labels (1)
0 Kudos
Reply
11 Replies

2,005 Views
webbersun
Contributor III

Hi,

    The Z4a core enters standby mode when Z2 core be waked up with   pretended networking mode. How  does the Z4a    waked up to work with the Z2  core ?

0 Kudos
Reply

2,005 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

look at the reference manual rev.4 chapter 8.6. There is detailed description how to do mode transition from LPU modes back to the DRUN mode.

Regards,

Martin

0 Kudos
Reply

2,005 Views
webbersun
Contributor III

Hi,

     What is default ID0 value ? I don't look for it in Reference Manual.

0 Kudos
Reply

2,005 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

every FlexCAN message has ID. ID can be standard or extended. In my example, standard ID = 0 is the criteria for wake up the micro from LPU_STOP.

Sou you have to send the message to micro and this message must have set standard ID = 0.

Regards,

Martin

0 Kudos
Reply

2,005 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

I edited my project and I have added led toggle to while(1). I also tested it and it works correct. Look at the attachment. Do not forget to connect LED to PA[1] pin.

1) You have to send CAN message with ID0 to the micro. This message wakes up the micro from LPU_STOP to LPU_RUN.

2) It is not necessary to configure any other register. With ID0 it works by default. But of course there are various possibilities how to configure receive filters.

3) About AUTOSAR OS, I am not sure if it will work. I do not know, how AUTOSAR deals with switch Z4 core to LPU mode.

About MPC5746C it should also supports CAN Pretended Network.

Regards,

MArtin

0 Kudos
Reply

2,005 Views
webbersun
Contributor III

Hi Martin,

      I tested  again your example which only added toggle LED at while(1) loop in LPU_Stop_Init function. I send CAN message to wake up, but toggle LED don't work as well. I can't use debugger of S32 Studio, because i use GHS probe.

1. Could it need to send CAN message to Wake up? 

2. What don't setup  register about PN mode as like CAN_0.FLT_ID1.B.FLT_ID1?

3. My project use Freescale AUTOSAR OS, that works with single core Z4. Can It support PN mode? Maybe, my company will change chip MPC5748G to MPC5746C in the future. Could it  supply this function?

0 Kudos
Reply

2,005 Views
webbersun
Contributor III

Hi Martin,

    I had test sample code, but didn't to work as well. I modified some code for Freescal  EVB board . I had programmed  Z2 and Z4 ELF files into flash with GHS.

1.  add some GPIOs to check status, if wake up successfully.

2. change FlexCAN baud rate, 500 kbps, and send CAN message to wake up by the other board.

3. I tried both function LPU_Init() & LPU_Stop_Init().  I observed that the function LPU_Stop_Init() enter  IVOR4_Handle.

What to mean the z2_restart.s was necessary modified.

0 Kudos
Reply

2,005 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

1) There is while(1) loop in LPU_Stop_Init function. After the wake up, MCU will execute this infinite loop, so this could be use as the check of wake up. But do not forget, it still runs from RAM memory, not from flash, and Z4 core is still in low power. Also Z2 is in LPU_RUN mode.

2) This changes should not affect the functionality.

3) In my example, there is not any IVOR4 interrupt handler and also there are not any interrupt sources, so I think it is not possible to get IVOR4 in my example.

From your sentence "I tried both functions" I am not sure, if you understand my example correct. It is necessary to use both function in the correct order. At first, LPU_Init has to be called. This function switch MCU to LPU_RUN mode and Z4 cores are disabled. Z2 core runs from RAM memory. Then LPU_Stop_Init has to be called. This function has to be placed in the beginning of the RAM, because after mode transition to LPU_RUN, Z2 is reset and started to run from 0x40000000 address. This is also the reason, why the stack initialization has to be done again (file z2_restart.s)

At first, try my example without changes and it should works (I tested it). I also recommend you to use Lauterbach debugger, because I am not sure if it will be possible to debug this example with for example PE Micro.

Regards,

Martin

0 Kudos
Reply

2,005 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

I have created example for Pretended network mode for MPC5748G. You will find at this URL:

Example MPC5748G PretendedNetworkingCAN S32DS

But there are some traps, which has to be solved before you are able to switch micro to LPU_STOP mode. At first, look at the linker files. There are added some sections. Second, look at the z2_restart.s file which is necessary for correct e200Z2 boot.

I tried to create as many comments as possible to explain code functionality, but if you have any question, please feel free to write me back.

Regards,

Martin

0 Kudos
Reply

2,005 Views
cuongnguyenvan
NXP Employee
NXP Employee

hI Martin,

I did not know exactly about when restart e2z core in your project.
this one beginning restart when write STANDBY to core 1 or other point.

Please tell me that

0 Kudos
Reply

2,005 Views
xiaoyali
Contributor I

hi

i have Test it on mpc5746c. i find that the procedure cannot work normal,when i add the section as follows:

/**********************************************/
.MyRamCode :
{
MY_RAM_START = .;
KEEP (*(.MyRamCode))
MY_RAM_END = .;
} > m_data AT> m_text /* > m_my_ram AT>m_my_flash */
/************************************************/

if change it as follows

/**********************************************/
.MyRamCode : 
{
MY_RAM_START = .; 
KEEP (*(.MyRamCode)) 
MY_RAM_END = .; 
} > m_text /* > m_my_ram AT>m_my_flash */
/************************************************/

 the procedure canwork normal can work normal,but canot test lpu run 

S32 Design Studio for Power Architecture

Version: 1.2
Build id: 170613

i think s32 1.2 has some problem when the VMA is different form LMA ?

0 Kudos
Reply