MQX: Customizing a BSP for new hardware

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

MQX: Customizing a BSP for new hardware

Jump to solution
2,872 Views
kerose98
Contributor II

I need to develop a BSP based upon bsp_twrk60f120m - the difference between the TOWER version and MY version is the absence of a 12 MHz source - I only use a 50 MHz source.  I cloned the BSP over to my BSP, and I know I need to change clock settings - I am just not sure where to do it.  Note that I developed a "test" application to check out peripherals that does NOT use MQX - just Processor Expert.  The non-RTOS version worked fine.  I just want to be able to run my RTOS.  I am attaching a schematic of my system - I would appreciate any ideas.

1 Solution
1,617 Views
c0170
Senior Contributor III

Hello ,

@Kevin:

Have you tested your board initialization with bare-metal application (= without MQX) , this could facilitate an initialization process. Or use Processor Expert, and then copy functional clocking initialization into __pe_initialize_hardware.


@Thomas:

once you work it out, post what could be improved :smileywink:


Regards,

c0170

View solution in original post

0 Kudos
Reply
6 Replies
1,617 Views
kerose98
Contributor II

In continuing this work, I am having a challenging time getting my system to run.  The only difference between my board and the bsp_twrk60f120m:  My clocks are the 50 MHz oscillator and the 32.768 kHz crystal (just like on bsp_twrk60f120m) - I do NOT have the 12 MHz clock/crystal.  Given that is the ONLY change, how do I modify the files?  I am going through trial-and-error while looking at the microcontroller manual, but I am having a hard time getting this up.  I need more in-depth information - I can't just keep guessing.

1,618 Views
c0170
Senior Contributor III

Hello ,

@Kevin:

Have you tested your board initialization with bare-metal application (= without MQX) , this could facilitate an initialization process. Or use Processor Expert, and then copy functional clocking initialization into __pe_initialize_hardware.


@Thomas:

once you work it out, post what could be improved :smileywink:


Regards,

c0170

0 Kudos
Reply
1,617 Views
kerose98
Contributor II

I was able to assimilate all the answers to find a solution.  It turns out that I had 2 problems:  Clocks and pin assignment

(1) With clocking, I used the "processor expert" in a non-RTOS project that worked for my timing setup.  Using the BSP from an appropriate existing tower board (in this case bsp_twrk60f120m), I set up the clock accordingly - the difference in my board is that I do not have a 12 MHz clock source (although I do have the 50 MHz and 32.768 kHz sources connected in the same way as on the tower board).  This at least got the RTOS running.

(2) I did not have RS-232 communications - As suggested, I modified _bsp_serial_io_init in init_gpio.c from my new BSP.  I modified the code for the case of UART3.  Now I have communications from hello.c!

(3) I also tried out the micro-SD sample program on my new board, and it now runs without modifications.

(4) Here is a useful tool I think Freescale could develop:  It would be an enhancement to the BSP wizard.  It would ask about external clocks and where they are connected and what they are.  You can make that kind of selection in the Processor Expert, but you have to be an "expert" on the processor to do so.  The PCR adds a layer of complexity.  After verifying that the clock settings are good, the wizard could then go pin-by-pin as to functionality and allow the user to specify constants and variables.  Such a wizard would save much frustration!

By the way, I did use the BSP cloning wizard - that helped immensely!

I would recommend a comprehensive set of instructions with examples for developing a BSP.

Thank you for your assistance!

0 Kudos
Reply
1,617 Views
DustyStew
Contributor V

I am facing a similar fate, being a new user of MQX & Kinetis, and having to create a BSP.

Initial evaluation is that MQX is basically a good system. Designed by Canadians, it should be.

But it seems the Freescale hardware, software, and documentation are all over the map in terms of interoperability. There is very little alignment such that things actually work out-of-the-box. So it appears that working with this stuff will be something like the old days, where you hit the books hard, and after 3 days you might have an LED flashing.

1,617 Views
anthony_huereca
NXP Employee
NXP Employee

Rhyme is correct, that function is part of the MQX initialization sequence where the very basic configuration is setup. Anything that you would need to have initialized before an RTOS could even start, like the clocks.

The typical files you'd be modifying when porting to a new board are all in the BSP folder (\mqx\source\bsp\<board_name>), and are:

bsp_cm.c - Initialize clocks

init_hw.c - Initialize Flexbus, DDR, etc

init_gpio.c - Initialize the specific pin muxing needed for a peripheral module

init_*.c - Set the parameters for a module (baud rate, buffer size, etc)

Then in \config\<board_name>\user_config.h you would set which UART/SPI/I2C/etc you would want to use on your board.

Those #defines are then used in init_bsp.c to determine which modules to initialize.

1,616 Views
Rhyme
Contributor III

When I ported MQX to our EPD evaluation board running with K10,

I modified

void _bsp_initialize_hardware(void)

function in

BSP Files\bsp_cm.c

to reflect our hardware settings.

0 Kudos
Reply