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

Does bluetooth need to know if the board is a V2.0 or V2.2? #208

Closed
microbit-carlos opened this issue Jul 8, 2022 · 5 comments · Fixed by #255
Closed

Does bluetooth need to know if the board is a V2.0 or V2.2? #208

microbit-carlos opened this issue Jul 8, 2022 · 5 comments · Fixed by #255
Assignees
Milestone

Comments

@microbit-carlos
Copy link
Collaborator

Board ID for BLE added in PR #114

Actually at this point in time CODAL it's not recognising V2.2 on BLE init, only V2.0:

int versionIdx = 0;
switch ( board)
{
case 0x9903:
case 0x9904: break;
default: versionIdx = 1; break;
}
ManagedString modelVersion( MICROBIT_BLE_VERSION[versionIdx]);
ManagedString disName( MICROBIT_BLE_MODEL);
disName = disName + " V" + modelVersion;

I don't know exactly how this string is used, but it's all processed in the MicroBitBLEManager::init() method. Is it necessary for this BLE string to distinguish between V2.0 and V2.2? Should we just hardcode a V2 string?

Without knowing much about how the BLE stuff is set up, is this information provided as a specific "info" service with a characteristic that provides board info (in which case it might be useful to provide more detailed information)?
Or is it part of a string that is broadcasted in some other way? (in which case it's less important, we might care to connecto a "BBC micro:bit V2" device, doesn't need to say "BBC micro:bit V2.0")

Does this string need to be set up in MicroBitBLEManager::init()? Or is there a different function that could provide this values? (for example, if it's a characteristic that is read, the DAPLink I2C version check can be done on demand)

The reason this is worth considering is that it might be beneficial to avoid having this DAPLink I2C transaction on uBit object init:

#if CONFIG_ENABLED(DEVICE_BLE) && ( CONFIG_ENABLED(MICROBIT_BLE_PAIRING_MODE) || CONFIG_ENABLED(MICROBIT_BLE_ENABLED))
MicroBitVersion version = power.getVersion();
#endif

We are considering to panic when the DAPLink I2C comms fails in ticket #137, and for example, if the board is in MAINTENANCE mode and the programme running doesn't use BLE or datalogging, it's better to just run as normal instead of panicking.

@microbit-carlos
Copy link
Collaborator Author

@martinwork
Copy link
Collaborator

@microbit-carlos The version is used only for a suffix on the model name in the device information service, for the benefit of clients of the BLE services. The question is whether BLE clients need to distinguish V2.0/V2.2, or V2/V3.

The model name currently differentiates V2.0 from newer versions. See the question about future versions in #77. The idea was also discussed in https://github.com/microbit-foundation/codal-microbit/issues/67 (private), and in lancaster-university/microbit-dal#373.

If power,GetVersion() returned something invalid, say zero, it would be V2.X. I don't know if this string is being used anywhere. The iOS micro:bit app guesses V1/V2 based on the different DFU services, which is what gave rise to the question about how a BLE app should distinguish V1 and V2. It hasn't been changed to use the model string.

@microbit-carlos microbit-carlos added this to the v0.2.42 milestone Aug 11, 2022
@microbit-carlos
Copy link
Collaborator Author

Thanks Martin, that's really useful to know!

From the top of my head I can't think of a reason why a BLE client would need to differentiate between a V2.00 and a V2.2x. So that could be hardcoded to V2?
If there is a reason to tell the difference, I think there should also be a "Hardware Revision String" in the Device Information characteristics? CODAL could always retrieve the Board ID from DAPLink on demand when that characteristic is read?

@martinwork
Copy link
Collaborator

It could be hard coded by reverting #114. I can't remember why the model string was chosen. I don't know if you could do the I2C comms inside a BLE event handler.

@microbit-carlos microbit-carlos modified the milestones: v0.2.43, v0.2.44 Sep 15, 2022
@JohnVidler JohnVidler modified the milestones: v0.2.44, v0.2.45 Oct 17, 2022
@JohnVidler JohnVidler added the p2 label Oct 17, 2022
@microbit-carlos microbit-carlos modified the milestones: v0.2.45, v0.2.48 Jan 18, 2023
@microbit-carlos
Copy link
Collaborator Author

We are happy for this to be hardcoded in CODAL to indicate V2 only.

microbit-carlos added a commit to microbit-carlos/codal-microbit-v2 that referenced this issue Jan 27, 2023
Before PR lancaster-university#114 the string was "BBC micro:bit V2.0", with that PR
it was updated to indicate "BBC micro:bit V2.0" for board ID 0x9904
and "V2.X" to any unknown board ID (currently V2.2 boards would still
appear as "V2.X").

lancaster-university#114

There is no need for BLE apps or devices to distinguish between
different V2 versions, just as we currently don't differentiate between
V1.3 and V1.5.

Hardcoding this in CODAL to be "BBC micro:bit V2" also removes
an I2C call to the interface chip on uBit.init(), which help us better support
unofficial interface chip firmwares, like Segger's J-Link.

Fixes lancaster-university#208

Related to lancaster-university#137
@microbit-carlos microbit-carlos modified the milestones: v0.2.48, v0.2.49 Jan 27, 2023
JohnVidler pushed a commit that referenced this issue Jan 30, 2023
)

There is no need for BLE apps or devices to distinguish between
different V2 versions, just as we currently don't differentiate between
V1.3 and V1.5.

Fixes #208

Related to #137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants