USB-KW41Z : Write firmware with fsci_bootloader.py

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

USB-KW41Z : Write firmware with fsci_bootloader.py

1,295 Views
norishinozaki
Contributor V

I'm trying to use USB-KW41Z as Thread interface for Linux router.

I built bootloader_fsci.bin for usbkw41z_kw41z and wrote it by J-Link.

Then I built host_controlled_device.bin with gUseBootloaderLinkg_d = 1 and THR_SERIAL_TUN_ROUTER = 1.

After built and installed hsdk, I tried to write host_controlled_device.bin using fsci_bootloader.py.
But it fails...

# python fsci_bootloader.py /dev/ttyACM0 host_controlled_device.bin -e

Namespace(bin='host_controlled_device.bin', chunk_size=2048, dev='/dev/ttyACM0', disable_crc=False, erase_nvm=True)
[Command 0] /dev/ttyACM0: FSCIEnterBootloaderRequest -> { }
[Command 1] /dev/ttyACM0: FSCIFirmware_CancelProcessRequest -> { }
No response for the previous command <com.nxp.wireless_connectivity.commands.firmware.frames.FSCIFirmware_CancelProcessRequest object at 0x7f0cb68be9d0>
Cannot communicate with the board, please try again. Exiting..

$ ./GetKinetisDevices
NXP Kinetis-W device on /dev/ttyACM0.

# cat hsdk.log

HSDK_INFO - [-1168365760] [PhysicalDevice]InitPhysicalDevice:Allocated memory for PhysicalDevice
HSDK_INFO - [-1168365760] [PhysicalDevice]InitPhysicalDevice:Initialized device's message queue
HSDK_INFO - [-1168365760] [PhysicalDevice]InitPhysicalDevice:Created event manager for device
HSDK_INFO - [-1168365760] [PhysicalDevice]InitPhysicalDevice:Created startThread event
HSDK_INFO - [-1168365760] [PhysicalDevice]InitPhysicalDevice:Created stopThread event
HSDK_INFO - [-1168365760] [PhysicalDevice]AttachToConcreteImplementation:Attached to a concrete implementation
HSDK_INFO - [-1168365760] [PhysicalDevice]OpenPhysicalDevice:Created and start device thread
HSDK_INFO - [-1168365760] [Framer]InitializeFramer:Allocated memory for Framer
HSDK_INFO - [-1168365760] [Framer]InitializeFramer:Created stopThread event
HSDK_INFO - [-1168365760] [Framer]InitializeFramer:Initialized framer's message queue
HSDK_INFO - [-1168365760] [Framer]InitializeFramer:Created event manager for framer
~


My host PC is Ubuntu with kernel 4.4 with CONFIG_TUN=y.

Do I need to do something for bootloader_fsci.bin?

Labels (2)
0 Kudos
2 Replies

769 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Nori,

That message is because you are not entering in boot loader mode. So you can take a reference the

Kinetis Thread Stack FSCI Bootloader Quick Start Guide Chapter 3

C:\NXP\MKW41Z_ConnSw_1.0.2\docs\wireless\Thread

-The bootloader mode starts using the procedure of resetting the board by keeping SW4 switch for FRDM-KW41Z pressed or SW3 switch for USB-KW41Z pressed. The bootloader is waiting for the first application firmware to be transmitted from the host.

-Or  you can select if the bootloader automatically wait for the new firmware(without switch GPIO trigger)

rebuild the bootloader bin file in IAR EWARM or in KDS IDE after setting the gBootFlags attribute to value 0x00UL in the file middleware\wireless\framework_5.3.2\examples\common\bootloader\src\bootloader\main.c.

Default value of gBootFlags:
volatile const bootFlags_t gBootFlags __attribute__ ((section(".BootFlags"))) =
#endif
{
   0xFFFFFFFFFFFFFFFF
};
#endif
   should be updated to
volatile const bootFlags_t gBootFlags __attribute__ ((section(".BootFlags"))) =
#endif
   0x00UL
};
#endif

{

Hope it helps

Mario

0 Kudos

769 Views
norishinozaki
Contributor V

Hello Mario,

Thanks for help again!

I changed the BootFlags and wrote the new bootloader_fsci.elf and host_controlled_device.elf into a KW41Z part in USB-KW41Z(I'm using KDS to write firmware).

Then I plugged the USB to Linux Host, however nothing comes up in /var/log/syslog.

Now with or without changing the BootFlags, there is no /dev/ttyACMx created.

When use J-Link debugger  to convert from K41Z SWD to USB port to connect to Linux, I can see /dev/ttyACM0.

However  ./bin/Thread_KW_Tun /dev/ttyACM0 fslthr0 doesn't show any messages which I can get with FRDM-KW41Z as follows.

./bin/Thread_KW_Tun /dev/ttyACM0 fslthr0

[THR] Set 802.15.4 channel          OK!

[THR] Create Network                ALREADY CONNECTED!

[THR] Border Router Add Prefix      OK!

[THR] Border Router Sync Prefix     OK!

[MESHCOP] Start Commissioner        OK!

[MESHCOP] Add Expected Joiner       OK!

[MESHCOP] Sync Steering Data        OK!

Lately I wrote rndis_bridge to K22F in USB-KW41D for testing ND router.

Is this the reason?

Best regards,

Nori Shinozaki

0 Kudos