Booting MQX from FNET works _sometimes_ (and solution)

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

Booting MQX from FNET works _sometimes_ (and solution)

494 Views
Skyhawk
Contributor I

I'm using IAR + FNET + MQX + a custom K60 board.

 

I use this script from the FNET shell example application:

 

"dhcp; erase all; tftp; save; go" 

 

now first of all, I have hardcoded the start address in the go-command to 0xC411.

(see https://community.freescale.com/thread/100780

 

Now when after the application has been transfered and flashed by the TFTP command, the application starts _sometimes_ , about 50% of the time it hangs and the CPU is unresponsive (I cannot connect to it using the JTEG debugger. (in my case a Segger J-LINK).

 

I must say at this time, I am not sure how exactly the MCG is setup, as I do not understand that part yet.

I can tell from the source that:

 

#define FNET_CFG_CPU_CLOCK_HZ               (48000000)

 

is configured and the pll_init() function that is called in FNET's sysinit()  seems to work (it does not hang).

Also I have serial port communcation on ttyd: (connected to a serial port to my PC, no USB->serial stuff :smileyhappy:

 

Ok, so, what do we have: a working FNET example, dhcp works, tftp works.

However 'go' does not always work, even after a reset + 'go' , same problem, sometimes it works, sometimes it hangs.

 

I suspect that MQX assumes that the MCG is in FEI mode (FLL Engaged Internal), since this is the default after a reset.

I do not understand in what mode the MCG is after pll_init(), but looking at the MCG state-diagram I can see that not all transistions are possible. 

 

What I would like to do is put the MCG back into FEI mode before starting the MQX application, but I am not sure how to do that. (or what modes to go through, since several transistion might be needed).

 

I have however found an escape :smileyhappy:, I found that calling mcg_pee_2_blpi() puts the MCG in BLPI mode and appearently MQX finds that more acceptable because my application now always starts correctly.

 

Could someone shed some light on this, namely: what happens in pll_init() ? what mode is the result of this function and how can I get the MCG safely back in FEI mode ?

 

Greetings,

 

 

0 Kudos
1 Reply

243 Views
Mohsin455
Contributor IV

Hi Jan,

             I think I am also having similar problems. I am using FNET and MQX3.8. In my case the application hangs only when I download a new application using FNET. Once the TFTP download completes, the application starts as expected but stops after some time.

Once I power cycle the K60, the application runs fine. Are you seeing similar kind of issue and did you find any solutions ?

Thanks,

Mohsin455

0 Kudos