Unable to write to BLE characteristic that has write permission

15 ビュー (過去 30 日間)
Erik
Erik 2024 年 2 月 12 日
コメント済み: Erik 2024 年 2 月 26 日
I have an arduino hosting a Bluetooth Low Energy service, and while I can consistently connect and read from its characteristics using Matlab, writing to a characteristic fails with the message (Operation failed because access was denied).
I've printed out the characteristic's properties and can verify that it has the Write and WriteWithoutResponse attributes, so the connection should have write permission for the characteristic, but it still does not work.
I am using Windows 11 and the latest version of Matlab (R2023b). Any thoughts for how to resolve this issue?

回答 (1 件)

sai charan sampara
sai charan sampara 2024 年 2 月 26 日
Hello Erik,
I understand that you are trying to write to a characteristic using MATLAB. Writing to a characteristic is possible when the "Attributes" property of the input characteristic object has "Write" and/or "WriteWithoutResponse". In your case since both are present, using “write(characteristic, data)” to write to it should not give an error. Despite this getting the error “Operation failed because access was denied” indicates that the issue is not with MATLAB but rather might be with the system permissions. This error can occur when MATLAB does not have required permissions to perform the read/write.
The following actions could potentially resolve the error:
  • Run MATLAB as an Administrator. Right-click on the MATLAB shortcut or executable and select "Run as administrator."
  • Ensure that the file or folder you are trying to access or modify has the appropriate permissions for your user account. Check the permissions of the program files corresponding to arduino.You may need to adjust the permissions to allow MATLAB to perform the operation.
  • Temporarily disable any antivirus or security software that might be blocking MATLAB from performing the operation.
You can refer to the following links for more information:
  1 件のコメント
Erik
Erik 2024 年 2 月 26 日
I did try these previously without success. I'll try again, but it seems like it is not a permissions issue as Matlab writes to the BLE characteristic just fine if it is hosted from micropython. It is only when it is hosted from arduino C that Matlab (Windows 11) cannot write (although Matlab on Mac can, with the exact same code running on Matlab and arduino).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Arduino Hardware についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by