code on MK20DX256VLH7 to MK22DX256VLH5 problem

cancel
Showing results for 
Search instead for 
Did you mean: 

code on MK20DX256VLH7 to MK22DX256VLH5 problem

165 Views
Frankthetech
Contributor I

I am unable to get code for the MK20 to run on the MK22 chip.

I can flash the MK22 fine but it does not run as expected.

I worked backwards trying to just blink an led but that wont work either.

What are the differences I would need to address in code for the MK22?

Any help where I can look for ideas?

 

0 Kudos
5 Replies

148 Views
Frankthetech
Contributor I

Hi Myke, I did get it to run the blink code test, build and flash works.

I noticed the flash and ram locations differ from mk20 to mk22.

I write c code and manually build. Do you know where I could find out the differences between the two that will need to be dealt with?

My experience with mcuexpresso is limited, but will work with it some more.

Frank

0 Kudos

143 Views
myke_predko
Senior Contributor III

Hi @Frankthetech 

Could you share your led flash code?  I'm curious to see what your starting point is.  

You didn't answer my question about what are you trying to program - do you have the source code or are you loading an existing .axf file?  Do you have access to the application source code?  

Regardless, it doesn't sound like you're using libraries for your simple builds - what about the application?

0 Kudos

133 Views
Frankthetech
Contributor I

I attached the blink code as a text file, I can flash this and it runs fine.

I use .hex or .s19 file and flash with J-Link, I flash on a different computer and j-link won't do asp files.

My code that I'm trying to port is 2000ish lines and uses serial to receive data, drives an lcd display, writes to SD card.

I wrote the the application source code, so yes I have it.

It started as an arduino project (teensy 3.2 with the mk20dx256vlh7) and used libraries from there. I since dropped the teensy and built a board to use the mk20 chip directly.

It got to hard to write in the arduino IDE so I just used a code editor and compiled using the toolchain I had.

The shortage of the MK20 chips got me looking for alternatives I since I have some MK22's in stock I'm looking for a way to identify the the differences between the two chips and allow for it in code.

 

0 Kudos

126 Views
myke_predko
Senior Contributor III

@Frankthetech 

Thank you for the source - that gives me a good idea where you are.  Can I ask where you got the code for 

    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitBootPeripherals();
    BOARD_InitPins();

 I'm curious to understand how the clocks and pins were configured.  

Regardless, you've got a lot of work ahead of you.  

My recommendation is to install MCUXpresso, use the clock and pin wizards to configure a project to your device/circuit and then port over your code using the built in SDK libraries.  The bit advantage of doing this is in the case where you need to carry out this exercise again because you couldn't get more of the specific MK22 part and have to work with another device - I think that right now that's a really critical point to consider.  

The other approach is to go through the datasheets and reference manuals for both parts and check through the differences that you think will affect you.  This is a non trivial piece of work and it will be highly unlikely that you won't make a mistake in copying data from one location to another which means somewhat tedius debugging looking for a typo in an address or constant.  I would suggest that you don't consider this method because if you end up in the situation where you need to build more product and can't get the same MK22 part, you're going to have to repeat the work.  

Good luck and let us know how you make out or if you have any questions.  

0 Kudos

157 Views
myke_predko
Senior Contributor III

@Frankthetech 

You'll have to provide more information for us to help you find the best solution.  

Are you just programming the .axf file that worked for the MK20 into the MK22?  This won't work because there are differences between the two.  

Do you have the source code and what is the development tool that was used with it?  If it's MCUXpresso, chances are the port will be fairly simple with the biggest change being to build with the correct libraries.  

0 Kudos