ieee802.15.4 example project Can't run in KW21Z256

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

ieee802.15.4 example project Can't run in KW21Z256

Jump to solution
2,080 Views
jack2277
Contributor II

Hello, I need to develop an ieee802.15.4 application on KW21Z256.
I use the MCUXpressoIDE v11.1.1 for development with the following SDK:
SDK_2.2.3_MKW21Z256xxx4.zip
SDK_2.2.3_FRDM-KW41Z.zip


I was able to run the Driver example in KW21Z256 successfully by the following steps:
1. import the FRDM_KW41Z512 SDK Driver example for lpuart in MCUXpressoIDE.
2. change the MCU from KW41Z512 to KW21Z256 in the MCU Setting
3. change the MCU Memory Detail in the MCU Setting:
Program flash size from 0x80000 to 0x40000,
RAM start address from 0x1FFF8000 to 0x1FFFC000
RAM size from 0x20000 to 0x10000.
So far, I am able to debug the project and test the UART echo function on my custom board successfully.

Then I tried to import the ieee802.15.4 wireless example msn_end_device_bm for FRDM_KW41Z512. I had followed the same steps as above. Additionally, I modified memory limits in the linker file as following:
/*-Memory Limits-*/
__region_ROM_start__ = (0x00000000);
__region_ROM_end__ = (0x0003FFFF);
/* Workaround for SRAM boundary GCC placement issue,
not to place variables that are accessed by the code
overlapping this boundary (forbidden by the Kinetis architecture) */
__region_RAM1_start__ = (0x1FFFC000);
__region_RAM1_end__ = (0x1FFFFFFF);
__region_RAM2_start__ = (0x20000000);
__region_RAM2_end__ = (0x2000BFFF);

Now, I was able to build the project successfully and download the code into the same board (KW21Z256) using JLink. However, when I tried to debug the project, the program did not start at main(). It went to an unexpected and unknown location, even after I clicked "Restart" Button.
When I clicked "Suspend" Button, the Debug Window shown the following information:

frdmkw41z_wireless_examples_ieee_802_15_4_msn_end_device_bm JLink Debug [GDB SEGGER Interface Debugging]
frdmkw41z_wireless_examples_ieee_802_15_4_msn_end_device_bm.axf
Thread #1 57005 (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
__udivsi3() at 0x600
__aeabi_fsub() at 0x1610
0x100
arm-none-eabi-gdb (8.3.0.20190703)

Could you please advise how to run the ieee802.15.4 example correctly in my custom board (KW21Z256)?
Thank you very much!

0 Kudos
1 Solution
1,687 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @jack2277,

I hope you are doing great and sorry for the late response.

First, I don't have a KW21Z board in order to validate the project.

Attached are the changes that I'm considering required for porting an example from KW41Z to KW21Z.  The project is based on the SDK_2.2.3_MKW21Z256xxx4.

As a note from your details, the RAM size for KW21Z is 64k => we will have 2 sections: 

SRAM_L = 0x1FFF8000 -> 0x1FFFFFF

SRAM_U = 0x20000000 -> 0x20007FFF

Please let me know your findings.

Regards,

Mario

View solution in original post

0 Kudos
10 Replies
1,688 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @jack2277,

I hope you are doing great and sorry for the late response.

First, I don't have a KW21Z board in order to validate the project.

Attached are the changes that I'm considering required for porting an example from KW41Z to KW21Z.  The project is based on the SDK_2.2.3_MKW21Z256xxx4.

As a note from your details, the RAM size for KW21Z is 64k => we will have 2 sections: 

SRAM_L = 0x1FFF8000 -> 0x1FFFFFF

SRAM_U = 0x20000000 -> 0x20007FFF

Please let me know your findings.

Regards,

Mario

0 Kudos
1,644 Views
jack2277
Contributor II

Hi, Mario,

I have just tried to run the project provided into my custom board. It works well now.

Thank you very much for your help.

 

itworks.PNG

1,843 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @jack2277 ,

I am sorry for my late reply. I am still working on your issue. I will get back to you as soon as possible.

Sorry for any inconvenience that this may cause you.

Regards,

Mario

0 Kudos
1,918 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @jack2277,

I have been checking the issue that you are facing.

-Could you please provide an image that the issue that you are facing and capture the IDE that when the issue occurs? 

Is it possible that you could share the complete project that you modify?

-It is a very strange issue, however, is it possible that you could create a new project and copy all the folders that the projects need to run the 802.15.4 example?

Regards,

Mario

0 Kudos
1,878 Views
jack2277
Contributor II

Hi, Mario,

Sorry for the late reply.

I just created the project from the example and modified the memory size and memory start address in the linker file (MKW41Z512xxx4_connectivity.ld) as following. 

Linker1.PNG

Then I changed the MCU type to MKW21Z256xxx4 and memory setting in MCU settings.

MCU.PNG

 Finally, I tested the project with KW41Z512 MCU using jLink, it worked well. The program started in main() as expected.

KW41Z512_OK.PNG

 

 

 

 

However, when I tested the same project with KW21Z256 MCU, it failed. The program did not start in main() as expected. When I pressed "Pause" button, it showed as following.

KW21Z256_failed.PNG

Are there any settings missed in the project? 

Please kindly advise.

Thank you!

The project is attached for reference.

 

0 Kudos
1,954 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Jack,

I am checking this by my side. I will get back to you as soon as possible.

Regards,

Mario

0 Kudos
1,991 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Jack,

But still, I could not make the ieee802.15.4 example project working in my custom board with MCUXpresso IDE. 

The IEEE802.15.4 needs more memory to run the example project.

What are the changes that you did in IAR? What is the start address that you changed in IAR?

Regards,

Mario

0 Kudos
1,988 Views
jack2277
Contributor II

Hi, Mario,

In the IAR, I right clicked the project ->Options ->General Options ->Target.

Then select the "Device" as "NXP MKW21Z256xxx4". 

For the linker file (MKW41Z512xxx4_connectivity.icf), I changed the memory Limits Section as followings:

/*-Memory Limits-*/
define symbol __region_ROM_start__ = 0x0;
define symbol __region_ROM_end__ = 0x0003FFFF;
define symbol __region_RAM_start__ = 0x1FFFC000;  /*0x1FFF8000*/
define symbol __region_RAM_end__ = 0x2000BFFF;  /*0x20017FFF*/ 

 

By the way, I also failed to run the ieee802.15.4 example project with FreeRTOS  in the FRDM-KW41Z with MCUXpresso IDE. But I was able to run the ieee802.15.4 example project with BM successfully in the FRDM-KW41Z. Therefore, I also tried the ieee802.15.4 example project with BM in my custom board(using KW21Z256) with MCUXpresso IDE but failed unfortunately.

My custom board(using KW21Z256) could run the ieee example project with BM in IAR successfully.

Thus I guess there are some settings missed in the MCUXpressoIDE.

0 Kudos
2,013 Views
jack2277
Contributor II

Hi, Mario,

The reference manual does not show the difference of SRAM between the 512KB version and the 256KB version. 

But, I was not able to run any example projects (even helloworld project) in the 256KB version without modifying the SRAM Start Address. 

Then I referred to SDK_2.2.3_MKW21Z256xxx4/MKW21Z256xxx4_manifest.xml (line 989) and made the driver example projects working in KW21Z256. But still I could not make the ieee802.15.4 example project working in my custom board with MCUXpresso IDE. 

For your information, I could make ieee802.15.4 example project working with IAR by modifying the SRAM start address in the linker file.

Now, I would like to switch the development from IAR to MCUXpresso IDE. But I guess there are still some project settings missing for the MCUXpresso IDE.

<core id="core0_MKW21Z256xxx4" fpu="false" name="core0" type="cm0plus"/>
<memory flash_size_kb="256" ram_size_kb="64">
<memoryBlock id="PROGRAM_FLASH_MKW21Z256xxx4" name="PROGRAM_FLASH" addr="00000000" size="00040000" type="Flash" access="RO"/>
<memoryBlock id="SRAM_MKW21Z256xxx4" name="SRAM" addr="1fffc000" size="00010000" type="RAM" access="RW"/>
</memory>

 

0 Kudos
2,019 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Jack,

Is there a specific reason that you change the RAM start Location?

the RAM start address from 0x1FFF8000 to 0x1FFFC000

Regards,

Mario

0 Kudos