Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review and merge codal-microbit-nrf5sdk PRs #257

Open
microbit-carlos opened this issue Jan 27, 2023 · 6 comments
Open

Review and merge codal-microbit-nrf5sdk PRs #257

microbit-carlos opened this issue Jan 27, 2023 · 6 comments
Milestone

Comments

@microbit-carlos
Copy link
Collaborator

As they are in the micro:bit Foundation org they cannot be added to the CODAL project board, so creating this issue to be able to track them:

@martinwork
Copy link
Collaborator

When I tried the ble_test() sample just now the services and characteristics don't all fit. The UART characteristics are missing.

The first PR above was intended to fix that, but some caution is needed now because the build has changed since I made that PR.

@martinwork
Copy link
Collaborator

@microbit-carlos @JohnVidler I think the effect of not having microbit-foundation/codal-microbit-nrf5sdk#13 is that when MakeCode is set to no pairing required, the build uses open security for everything except the Nordic DFU characteristic. The iOS app first writes to an open security characteristic, then fails to flash with the error authentication is insufficient for the Nordic DFU. A workaround is to use MakeCode Edit Settings As Text to define "security_level": "SECURITY_MODE_ENCRYPTION_OPEN_LINK" instead if the default null.

@microbit-carlos
Copy link
Collaborator Author

So does that mean that when this option is set in MakeCode the micro:bit cannot be flashed via the apps?
image

@martinwork
Copy link
Collaborator

@microbit-carlos I believe an open link hex from MakeCode can be flashed but can't be flashed over. Only tested in iOS. I dragged the the open link hex to the MICROBIT drive, then tried to pair with and BLE flash over it with the iOS app.

It may be that if you have paired with another hex, then BLE flashed an open link hex, the pairing will allow another hex to be flashed. I'm not sure exactly what MakeCode creates, but I think this is a likely explanation for the authentication is insufficient error.

@microbit-carlos
Copy link
Collaborator Author

Is it safe to assume this was also a problem in MakeCode v5? The issue is not something introduced between v5 and v6?

@microbit-carlos microbit-carlos added this to the v0.2.57 milestone Jul 18, 2023
@martinwork
Copy link
Collaborator

Compare
https://github.com/microbit-foundation/codal-microbit-nrf5sdk/blob/master/sdk_config/sdk_config.h#L102
with
https://github.com/lancaster-university/codal-microbit-v2/blob/master/inc/MicroBitConfig.h#L178
The latter is correct because it doesn't redefine MICROBIT_BLE_SECURITY_MODE when MICROBIT_BLE_OPEN has already defined it.

If I build microbit-v2-samples ble-test() with the codal.json below I can go through the pairing process with it in the app, then flash over it. MICROBIT open good.zip

If I remove the last line from codal.json or change the value to null and rebuild, there are lots of warnings (warning: "MICROBIT_BLE_SECURITY_MODE" redefined) but it does build. Pairing with the result fails with Authentication Insufficient.
MICROBIT open bad.zip

I also get Authentication Insufficient pairing with this, saved from MakeCode v5 microbit-openlink-v5 (8).zip https://makecode.microbit.org/_UMt84d9Cuiut

If I pair with a normal, MakeCode just works hex, and BLE flash an open hex over it, sending another hex initially fails. If it was a "good" open hex, it's possible to recover by pairing again, but pairing with a "bad" open hex fails with Authentication Insufficient.

{
    "target": {
        "name": "codal-microbit-v2",
        "url": "https://github.com/lancaster-university/codal-microbit-v2",
        "branch": "master",
        "type": "git"
    } ,
    "config":{
        "DEVICE_BLE": 1,
        "MICROBIT_BLE_ENABLED" : 1,
        "MICROBIT_BLE_PAIRING_MODE": 1,
        "MICROBIT_BLE_DFU_SERVICE": 1,
        "MICROBIT_BLE_DEVICE_INFORMATION_SERVICE": 1,
        "MICROBIT_BLE_EVENT_SERVICE" : 1,
        "MICROBIT_BLE_PARTIAL_FLASHING" : 0,
        "MICROBIT_BLE_OPEN" : 1,
        "MICROBIT_BLE_SECURITY_LEVEL": "SECURITY_MODE_ENCRYPTION_OPEN_LINK"
    }
}

@microbit-carlos microbit-carlos modified the milestones: v0.2.57, v0.2.58 Jul 25, 2023
@microbit-carlos microbit-carlos modified the milestones: v0.2.58, v0.2.59 Aug 2, 2023
@microbit-carlos microbit-carlos modified the milestones: v0.2.60, v0.2.61, v0.2.62 Sep 15, 2023
@microbit-carlos microbit-carlos modified the milestones: v0.2.64, v0.2.65 Oct 12, 2023
@microbit-carlos microbit-carlos modified the milestones: v0.2.65, v0.2.66 Nov 3, 2023
@microbit-carlos microbit-carlos modified the milestones: v0.2.66, v0.2.67 Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants