I am using MQX4.1 and CW10.6 and recently made a custom board using MK60DN512VLQ10. I did all my program dev on K60 tower module. I switched processor used under bsp using processorexpert. I changed the I/O around so there was no conflicts, everything compiles, no issues. I can load the program successfully but only by using the flash file to target using PE multilink - Run and debug methods dont work. After program loads, I reboot my device and the led that is always supposed to come on never does, no lights come on Ethernet Jack when cable is plugged in, no signs of life, etc. I am sure it may be hardware issue, but just wanted to double check that there is not a setting I am missing in CW10.6/PE/MQX that says load program out of a particular area that changed going from tower to custom board.
Thanks in advance!
When you use PE for basic modification at new BSP, clock settings from PE “overwrite” MQX clock settings (more details in: Freescale_MQX_4_1\doc\tools\cw\MQX_Howto_Setup_Kinetis_Clock_UsingPE.pdf). However current pins configuration is typically modified when you install any MQX driver and this will probably overwrite your PE configuration. Please check mainly init_gpio.c file in your BSP source directory. You can see here pin configurations for various hardware modules. I would like to recommend modifications in this file according your board configuration.
If you want use some of PE drivers, you have to modify MQX drivers by PE code (or use directly MQX_Lite).
However from you description (debugging isn’t possible) it really looks like some hardware issue – probably in clock domain.
I suppose that you used TWR-K60D100M as pattern for your BSP, correct?
Could you please check whether you used clock source (crystal/oscillator) with the same/similar parameters? Could you please check by oscilloscope whether crystal/oscillator runs?
You can try placing here your schematic and I will check it for any obvious or potential issues.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks for Reply!
I fought through some issues but still do not have running board. I was finally able to debug and seen my code gets stuck in a while loop in cpu.c due to incorrect clock settings. I do not have external osc on custom board, so I change clock config to use FEI and problem seem to go away. Now, I debug and get stuck in mqx.c line 386. Comments on mqx_exit functions say:
It is important to ensure that the environment (boot call stack) the
* MQX is returning to is in the consistent state. This is not provided by
* distributed MQX BSPs, because the boot stack is reused (rewritten) by MQX
* Kernel data. Set the boot stack outside of Kernel data section to support
* correct _mqx_exit() functionality.
How do I set the boot stack outside of the Kernal data???
#if MQX_EXIT_ENABLED || MQX_CRIPPLED_EVALUATION
kernel_data->USERS_ERROR = error;
if (kernel_data->EXIT_HANDLER) {
(*kernel_data->EXIT_HANDLER)();
}/* Endif */
MQX_LONGJMP( _mqx_exit_jump_buffer_internal, 1 );
#else
while (TRUE) { <-----line 386
} /* Endwhile */
#endif
} /* Endbody */
Yes I agree that this description isn’t very clear, but it is simple.
You code call function for exit from mqx code.
There are two options how to continue after MQX exit:
Of course, this is absolutely out of control of MQX which already ends.
Is the calling of _mqx_exit function happening in error or is this normal MQX operation to call this function? How do I fix?
I change MQX_EXIT_ENABLED to 1 in small_ram_config.h and now I am stuck here in _arm_end.c:
/*
* _ExitProcess
*
*/
extern void _ExitProcess(int status) _EWL_WEAK;
extern void _ExitProcess(int status)
{
#if defined(__SEMIHOSTING)
sys_exit(status);
#endif
while (1);
}
_mqx_exit is standard function which is used in both cases.
You can call _mqx_exit when MQX finish his work and there isn’t any task for executing like in case of bootloader (_mqx_exit(0), This will cause exit bootloader mqx app and execute the new image).
Or, you can call _mqx_exit in case of any fatal error (e.g. _mqx_exit(1), in case of out of memory issue).
__arm_end.c is file from CW arm library, and it works likewise as in _mqx_exit however this is next step after _mqx_exit function. I suppose that you don’t have any other code except your MQX application, therefore you should search what cause call of _mqx_exit function in your case.
If you are not able debug it step by step, you can search using of _mqx_exit function in MQX directory and your project and use breakpoints for revelation of place where code calls _mqx_exit function.
Other way is create breakpoint at begin of _mqx_exit and look at call stack for search from where this function is called.
I choose FBI for clock config and I no longer have the mqx exit issue. Now I have the same exact issue as mentioned in this post here:MQX BSP Port CodeWarrior Debug Issue : problem is there doesnt seem to be answer to what fixed...
Execution starts at the program entry point in boot.S. The following lines of code are stepped through:
After line 20 in the above segment code jumps to line 3 in the following:
After this the execution jumps to startup.c inside asm void __thumb_startup(void). The _bl_init_registers fall through fine. After that the call to _bl_init_hardware takes the control to comp.c __init_hardware(void) and from there to init_hw.c and from there to CPU.c __pe_hardware_initialize(void). The following lines of code execute there:
At line 18 of the above segment on trying to step through it the control goes back to the first line of the boot.S segment of code given above and execution follows the same chain infinitely from there.