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

Recent commit broke Mario hub connection #442

Closed
dlech opened this issue Aug 18, 2021 · 11 comments
Closed

Recent commit broke Mario hub connection #442

dlech opened this issue Aug 18, 2021 · 11 comments
Assignees
Labels
bug Something isn't working hub: cityhub Issues related to the LEGO Powered Up Smart hub (Hub No. 4) hub: mario/luigi Issues related to the LEGO Mario and Luigi hubs hub: movehub Issues related to the LEGO BOOST Move hub hub: technichub Issues related to the LEGO Technic hub (Hub No. 2) software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime)
Milestone

Comments

@dlech
Copy link
Member

dlech commented Aug 18, 2021

On the other hand mario does have issues connecting with this update. I will investigate further!

Originally posted by @NStrijbosch in #432 (comment)

@dlech dlech added bug Something isn't working hub: cityhub Issues related to the LEGO Powered Up Smart hub (Hub No. 4) hub: movehub Issues related to the LEGO BOOST Move hub hub: technichub Issues related to the LEGO Technic hub (Hub No. 2) software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) labels Aug 18, 2021
@dlech
Copy link
Member Author

dlech commented Aug 18, 2021

pybricks/pybricks-micropython@1235b35 added a hack to allow connecting to a Mario hub, however pybricks/pybricks-micropython@d82175c and pybricks/pybricks-micropython@a4a85dd broke the workaround while fixing other issues.

@dlech dlech added the hub: mario/luigi Issues related to the LEGO Mario and Luigi hubs label Aug 18, 2021
@NStrijbosch
Copy link

Further observations while trying to connect to Mario from a Technic hub:

It seems the technic hub gets stuck in the PT_WAIT_UNTIL from line: 550-578 in bluetooth_stm32_cc2640.c
If I bypass these lines Mario does connect, but when attempting a write, i.e., pbdrv_bluetooth_write_remote, the program is stuck again.

@dlech
Copy link
Member Author

dlech commented Aug 27, 2021

This seems to be working since pybricks/pybricks-micropython@98fa91c.

@dlech dlech closed this as completed Aug 27, 2021
@dlech dlech self-assigned this Aug 27, 2021
@NStrijbosch
Copy link

For me this is still an issue.

I just tried (on a Technic Hub) the code you mentioned here: pybricks/pybricks-micropython#68:

from pybricks.hubs import ThisHub
from pybricks.iodevices import LWP3Device
from pybricks.parameters import Color

MARIO = const(0x43)
PORT_VALUE_MSG = const(0x45)

hub = ThisHub()

# Connect to the Mario
mario = LWP3Device(MARIO)
print("connected")

#subscribe to Mario barcode/color sensor
mario.write(b'\x0a\x00\x41\x01\x00\x01\x00\x00\x00\x01')

while True:
    msg = mario.read()

    kind = msg[2]
    
    if kind != PORT_VALUE_MSG:
        continue

    color = msg[6]
    
    print("color:", color)

    if color == 21:  # Mario is on red
        hub.light.on(Color.RED)
    else:
        hub.light.on(Color.BLUE)

Mario seems to connect, but the line print("connected" ) is not executed. The technic hub freezes and needs a reboot.

Since you mentioned you succeeded to run this example: could it be that our Mario's run different firmwares? I just updated the firmware of my Mario through the official app (So I am assuming my Mario is running the latest Firmware). A firmware request through the LWP3 REPL yields the following result:
image

@dlech
Copy link
Member Author

dlech commented Aug 30, 2021

I have the same Mario firmware version. I was testing using City hub (and Move hub).

Does the hub unfreeze if you disconnect Mario?

@NStrijbosch
Copy link

Just tested using a city hub, that one does work... So it might be Technic hub specific (I didn't expect it to be different to the city hub)

Does the hub unfreeze if you disconnect Mario?

No, the technic hub stays frozen when I shutdown Mario.

@dlech
Copy link
Member Author

dlech commented Aug 30, 2021

So it might be Technic hub specific (I didn't expect it to be different to the city hub)

I didn't expect it to be different either. I will try the Technic hub later.

@dlech
Copy link
Member Author

dlech commented Aug 30, 2021

Connecting is working for me with my Technic hub.

@dlech
Copy link
Member Author

dlech commented Aug 30, 2021

Maybe one thing to check... with the official LEGO firmware, read the Radio Firmware Version hub property of the hub. This might tell us if we have different firmware on the Bluetooth chip between our two Technic hubs.

@NStrijbosch
Copy link

I can confirm it is this specific hub that is causing the issue. I just tested with another Technic hub which can run the program successfully.

I flashed the official LEGO firmware on the first hub, but it is not recognized by the pybricksdev LWP3 REPL. Which is strange in itself. But also prevents me from checking the radio firmware version at the moment. I can investigate this specific hub a bit more in the coming days.

Just as an FYI:
I used this specific technichub over the past couple of weeks for my tests so:

  • before this commit it could connect to Mario and read/write
  • at the moment it can still connect to a City hub

@dlech
Copy link
Member Author

dlech commented Aug 30, 2021

Very interesting. Let's start a new issue for this specific hub. Since it doesn't work with Pybricksdev either, it is not just a Mario thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hub: cityhub Issues related to the LEGO Powered Up Smart hub (Hub No. 4) hub: mario/luigi Issues related to the LEGO Mario and Luigi hubs hub: movehub Issues related to the LEGO BOOST Move hub hub: technichub Issues related to the LEGO Technic hub (Hub No. 2) software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime)
Projects
None yet
Development

No branches or pull requests

2 participants