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.
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).
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).
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 ?