Flashing/Erasing boards using SPSDK integrated within GUI with python 3.12

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Flashing/Erasing boards using SPSDK integrated within GUI with python 3.12

跳至解决方案
2,565 次查看
Kateb
Contributor I

Seasons Greeting,

I'm using KW45B41Z with VID:PID=1FC9:0143 and SER=E2KIV02VWSX53.

My intent is to Flash and/or Erase, Set parameters, etc... using 

spsdk.mboot.mcuboot.py and other pieces of code from the spsdk integrated within python 3.12 GUI. 

But when running the GUI Erase function calling mcuboot flash_erase_all() for example, I get this kind of errors:

Exception in Tkinter callback
Traceback (most recent call last):
File "c:\Python312\Lib\tkinter\__init__.py", line 1948, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "C:\_dev\spsdk\examples\bmw-poc-gui.py", line 1133, in <lambda>
erase_board_button = tb.Button(blhost_frame, text='Erase Board', command= lambda: self.board.erase_board(self.vid_pid) , bootstyle = INFO)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\_dev\spsdk\examples\bmw-poc-gui.py", line 404, in erase_board
mb.reset(reopen=False)
File "C:\_dev\spsdk\spsdk\mboot\mcuboot.py", line 730, in reset
status = self._process_cmd(cmd_packet).status
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\_dev\spsdk\spsdk\mboot\mcuboot.py", line 129, in _process_cmd
assert isinstance(response, CmdResponse)
AssertionError

the piece of code I use :

    def erase_board(self, vid_pid
        interfaces = MbootUSBInterface.scan()
        if not interfaces:
            print("Not founded MCU-BOOT device")
            sys.exit()        
        with McuBoot(interfaces[1], True) as mb:
            try:
                mb.flash_erase_all()
            except McuBootCommandError as e:
                if e.error_value != StatusCode.ROMLDR_UNEXPECTED_COMMAND:
                    raise
            except subprocess.CalledProcessError as e:
                print(f"Command failed with return code {e.returncode}")
            except Exception as err:
                print(f"Command failed with return code {err}")
                print(err.args)     # arguments stored in .args
                x = err.args
                print(x)                    
            except McuBootError as e:
                print(str(e))
                sys.exit()                          
            mb.reset(reopen=False)
 

Thank for the help and for the work of the great team behind the great SPSDK library

Kateb

 
0 项奖励
回复
1 解答
2,386 次查看
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Kateb 

Sorry, I forgot to attach the attachment in previous comment.

Please see here, just put the blhost.exe in the same folder with the KW45_ProgrammingTool, then you can directly use.

 

Best regards,

Christine.

在原帖中查看解决方案

标记 (1)
0 项奖励
回复
10 回复数
420 次查看
Aladdine
Contributor I

Hello @Christine_Li

 

I am encountering the same issue as Kateb, is it possible for you to provide the password to access the zip file in order to flash the KW45 through the spsdk tool ? 

Aladdine_0-1729245299511.png

After monitoring the frames exchanged when flashing the demoboard KW45-EVK/LOC and the ones when flashing the KW45 chip are the same up until it stops in the middle of the exchange for no apparent reason. Maybe it has to do with the utility I am using.

Any guidance from your part would be greatly appreciated.

Thank you in advance, 
Aladdine.

0 项奖励
回复
2,539 次查看
Kateb
Contributor I

Thanks Christine.

The requirement of the python application is to allow our client to Flash/Erase etc...without having to put the board in mode ISP (Bootloader) manually.

Putting the board in mode ISP (Bootloader) and Resetting the board normal mode are  to be done programmaticaly by the python application (using GUI buttons)

Is these functionalities possible by integrating SPSDK within the python GUI application??

Thanks and Happy Holidays.

Kateb

0 项奖励
回复
2,521 次查看
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Kateb 

May I know your SPSDK version?

You can get version by "spsdk --version" command.

And about your KW45, which SDK version are you using? What's the example in your board right now?

 

Best regards,

Christine.

0 项奖励
回复
2,519 次查看
Kateb
Contributor I

Hi Christine,

Please see my comments below in green

May I know your SPSDK version?

SPSDK version is 2.0.1

And about your KW45, which SDK version are you using?

SDK 2.12.6

What's the example in your board right now?

FreeRtos digital-key-device

Thanks ...Kateb

0 项奖励
回复
2,514 次查看
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Kateb 

Thanks for your feedback.

Without GUI, just putting the board in mode ISP (Bootloader) and Resetting the board normal mode manually, does it work well?

Is these functionalities possible by integrating SPSDK within the python GUI application?

==>Actually, I think in theory, I think it is possible. But as I know, there is no customer to do in this way. I need to check with our internal team to double confirm.

Do you have full logs?

I checked the logs you provided, it seems it raises " No Response, Timeout Error !"

Christine_Li_1-1703762523409.png

Best regards,

Christine.

 

 

 

0 项奖励
回复
2,494 次查看
Kateb
Contributor I

Without GUI, just putting the board in mode ISP (Bootloader) and Resetting the board normal mode manually, does it work well?

putting the board in mode ISP works well on all boards, but one is refusing .... don't know why...

Is these functionalities possible by integrating SPSDK within the python GUI application?

==>Actually, I think in theory, I think it is possible. But as I know, there is no customer to do in this way. I need to check with our internal team to double confirm.

thanks

Do you have full logs?

Can't figure out where SPSDK is hiding the logs.....

0 项奖励
回复
2,406 次查看
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Kateb 

Thanks for your reply and HAPPY NEW YEAR!

I discussed with our internal team, we have a GUI tool can use. I will attach it as attachment.

Hope this tool can provide you some conveniece.

And about the error in your program, we need more time to discuss and track why.

But we have a suggestion that in your GUI program, you can use blhost to call flash-erase-all like below:

blhost.exe -p COM3,115200 flash-erase-all 0

Please have a try and remember to choose correct COM port.

And also, we have a guide: Updating KW45 Radio Firmware via ISP using SPSDK .

If you don't know before, this AN may bring some help to you.

 

Best regards,

Christine.

标记 (1)
0 项奖励
回复
2,387 次查看
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Kateb 

Sorry, I forgot to attach the attachment in previous comment.

Please see here, just put the blhost.exe in the same folder with the KW45_ProgrammingTool, then you can directly use.

 

Best regards,

Christine.

标记 (1)
0 项奖励
回复
1,775 次查看
Kateb
Contributor I
Hi Christine,
7zip is asking for password to unzip....Thanks
0 项奖励
回复
2,541 次查看
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Kateb 

I will deal with this case and check it on my local side, once have any updates, will let you know.

 

Best regards,

Christine.