MCU-Link blhost issue on macOS

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

MCU-Link blhost issue on macOS

5,401 次查看
dav1
Contributor V

Just got the new mcu link board. Tried to update it but this one fails..

./blhost --usb 0x1fc9,0x0021 get-property 1
Error: UsbHidPeripheral() cannot open USB HID device (vid=0x1fc9, pid=0x0021, sn=).%

 

It's enumerated by the mac correctly

USB COMPOSITE DEVICE:
Product ID: 0x0021
Vendor ID: 0x1fc9 (NXP Semiconductors)

Manufacturer: NXP SEMICONDUCTOR INC.
Location ID: 0x14100000 / 8
Current Available (mA): 500

 

Darwin imac.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64

(i.e. Catalina, 10.15.x)

 

 

thoughts?

0 项奖励
回复
18 回复数

5,323 次查看
dav1
Contributor V

found a workaround... but this feels wrong as it's a security risk having terminal apps being able to sniff the HID bus

checked this box in settings, restarted the terminal. seem ok

dav1_0-1607517714145.png

 

blhost -V -d --usb 0x1fc9,0x0021 get-property 1  

Inject command 'get-property'

[01 00 0c 00 07 00 00 02 01 00 00 00 00 00 00 00]

<03 00 0c 00 a7 00 00 02 00 00 00 00 00 00 03 4b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>

Successful response to command 'get-property(current-version)'

  - took 0.000 seconds

Response status = 0 (0x0) Success.

Response word 1 = 1258487808 (0x4b030000)

Current Version = K3.0.0
0 项奖励
回复

5,321 次查看
converse
Senior Contributor V

I’ve not tried this, but have you tries using sudo instead of the privacy settings?

0 项奖励
回复

5,318 次查看
dav1
Contributor V

sudo is required by default, not sure why, but I guess due to hid access being non explicit in the blhost source (IOHIDManager on mac passes in Null)

0 项奖励
回复

5,293 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

another test on mac OS version is 10.14.1. no issue for update.

0 项奖励
回复

5,303 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Dav,

Thanks for the clarification. 

Normally this blhost error (UsbHidPeripheral() can't open USB HID device....) is due to MCU is not in ISP mode. If I doesn't install J3, I will get same error.

please make sure you install jumper J3 to force MCU in ISP mode. reconnect board. Try again.

 

Have a nice day,

Jun Zhang

 

0 项奖励
回复

5,290 次查看
dav1
Contributor V

please please read my first post. board is in bootloader mode, you can see this from the usb vid string (and I can see it from the fact the led is red)

 

your issuein blhost starts with macOS 10.15 and forward due to new security restrictions

please try in 10.15 and 10.16 and you will see for yourself

0 项奖励
回复

5,260 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

here is response from SW team:

//////////////

Yes, I believe this is related to the app notarization requirement that is enforced starting with macOS Catalina for software distributed outside of the App Store.

In case of apps which cannot be verified, there is a notification like below, and the user needs to specifically allow the application in Security & Privacy Preferences the first time it is executed.

ZhangJennie_2-1607672311020.png

 

ZhangJennie_3-1607672331124.png

It's a nuisance, indeed, but the good news is that it should now be easy to address. The upcoming IDE 11.3.0 release will be the first one to ship with notarization on macOS, so we have already gone through the necessary infrastructure steps and we are now able to sign/notarize the binaries, so it's just a matter of packaging a signed version of blhost inside the firmware update package.

(As a side note, the readme only mentions macOS 10.13 - so prior to the version that mandates app notarization)

 

Regarding running as root, now that you've mentioned it, I realize it's inconvenient as it prevents using the utility through double-clicking in UI (and requires using a terminal). I'll need to check if we can do something to relax the requirement.

Either way, we'll update the readme to be more clear.

////////////

pls have a trial.

0 项奖励
回复

5,258 次查看
dav1
Contributor V

yep, please also make sure to look at how you use the hid manager to find the mcu endpoint, I believe iterating through all puts up more restrictions. So I'd explicitly filter Vendor Vid & Pid when opening the Hid manager

0 项奖励
回复

5,253 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

pls feedback:

1. if above solution can work for you. 

2. your concern when opening the Hid manager, the specific problem you have with screenshots.

0 项奖励
回复

5,297 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Dav,

First make sure J3 is installed.

We tested on OSX10.15, failed because Apple couldn't versify blhost was safe.. The release was checked with 10.13.

We will check it.

Jun Zhang

 

Best Regards

Jun Zhang

 

0 项奖励
回复

5,381 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

HI dav,

Here is some questions: - why do you update the firmware? purpose? - To identify the problem on board side or PC side, please try to update it on a windows PC. how it works?

 

Thanks,

Jun Zhang

0 项奖励
回复

5,363 次查看
dav1
Contributor V

Hi Jun, 

macOS is a supported platform by NXP so let's focus on getting this working.
- can you verify it works on your end?
- what os / config?
- can we get blhost to be signed to avoid security errors?

 

To answer why I want to upgrade. The quick-start guide explicitly says, please update since newer firmware might exist..   regardless, the rom-bootloader needs to work on mac for other development.

0 项奖励
回复

5,351 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Dav,

I tested the firmware of MCU-Link can be updated, but not use blhost directly.

To update the firmware on MAC, you need download MCU-LINK CMSIS - Mac Package from 

https://www.nxp.com/design/development-boards/lpcxpresso-boards/jtag-swd-debug-probe:MCU-LINK#t996

Here is the steps of update firmware:

Although MCU-Link comes with firmware installed, it is recommended that you update to the latest version. To perform the update:

1.3.1 Install jumper J3

1.3.2 Connect MCU-Link to your host computer via USB

1.3.3 Go to the scripts directory in the software package installation and run the program.cmd (Windows) or program (Linux/MacOS) script by double-clicking it. Follow the onscreen instructions.

1.3.4 Press Ctrl-C to exit the script.

1.3.5 Disconnect MCU-Link from the host computer, remove J3 and then reconnect to the computer.

1.3.6 Review the Readme.txt for other OS-specific setup.

For more information, see 

https://www.nxp.com/document/guide/get-started-with-the-mcu-link:GS-MCU-LINK

 

Please note, we use MCU-Link as debug probe, not LPC55s69 demo board.

 

Have a nice day,

Jun Zhang

 

 

0 项奖励
回复

5,347 次查看
dav1
Contributor V

Jun, please see my first post.

the MCU-LINK_CMSIS-DAP_V1_098 package does not work on macOS (have you tested it?)

blhost fails to connect to the usb hid device, most likely due to security or signing.

 

there are several github clones of blhost with various fixes for macos and linux, 
example: https://github.com/Lauszus/blhost

please help resolve this. best is if NXP puts the tool on github and make sure it works on macOS

0 项奖励
回复

5,332 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

You mentioned  MCU-LINK_CMSIS-DAP_V1_098 package does not work on macOS, what error message do have with this package?

As our guide doesn't encourage you use blhost. Did you test above step 1.3.1 to 1.3.6? which step has error? screenshot of it?

0 项奖励
回复

5,329 次查看
dav1
Contributor V

See my first post, all info is in there...

 

./blhost --usb 0x1fc9,0x0021 get-property 1
Error: UsbHidPeripheral() cannot open USB HID device (vid=0x1fc9, pid=0x0021, sn=).%
0 项奖励
回复

5,328 次查看
dav1
Contributor V

I ran the shell script called 'progam' first, but that just fails silently, 

so I looked in the source and the first thing it does is calling blhost, so what I did was to run that manually to be able to see the error above.

 

line 41:

dav1_0-1607514177581.png

 

 

0 项奖励
回复

5,324 次查看
dav1
Contributor V
0 项奖励
回复