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

edge connector blocks freeze code #3699

Open
PhilAtKitronik opened this issue Jul 28, 2021 · 19 comments
Open

edge connector blocks freeze code #3699

PhilAtKitronik opened this issue Jul 28, 2021 · 19 comments
Assignees
Labels
bug Something isn't working extension hardware p2

Comments

@PhilAtKitronik
Copy link

Describe the bug
edge connection extension blocks freezes code

To Reproduce
import the edge connection blocks in to arcade for using the pins from BBC micro:bit
The test code I was using was as follows

controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
    pins.P2.digitalWrite(true)
    pause(500)
    pins.P2.digitalWrite(false)
    pause(500)
})
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
    music.baDing.play()
})
let mySprite = sprites.create(img`
    . . . . . . . . . . b 5 b . . . 
    . . . . . . . . . b 5 b . . . . 
    . . . . . . b b b b b b . . . . 
    . . . . . b b 5 5 5 5 5 b . . . 
    . . . . b b 5 d 1 f 5 5 d f . . 
    . . . . b 5 5 1 f f 5 d 4 c . . 
    . . . . b 5 5 d f b d d 4 4 . . 
    . b b b d 5 5 5 5 5 4 4 4 4 4 b 
    b d d d b b d 5 5 4 4 4 4 4 b . 
    b b d 5 5 5 b 5 5 5 5 5 5 b . . 
    c d c 5 5 5 5 d 5 5 5 5 5 5 b . 
    c b d c d 5 5 b 5 5 5 5 5 5 b . 
    . c d d c c b d 5 5 5 5 5 d b . 
    . . c b d d d d d 5 5 5 b b . . 
    . . . c c c c c c c c b b . . . 
    . . . . . . . . . . . . . . . . 
    `, SpriteKind.Player)
forever(function () {
    controller.moveSprite(mySprite, 100, 100)
})

The sprite moves around, buzzer beeps when button A is pressed. on pin2 we have a small motor controlled via a FET. I expected the pin to go high wait and go low, to turn the motor on and off after 500 milliseconds. Once I press button B the code locks up and can not control the sprite or sound the buzzer.

I'm using the digital write high and low blocks as could not find the default pin for the vibrate block with regards to using the micro:bit hardware

@abchatra abchatra added bug Something isn't working extension p2 hardware labels Aug 2, 2021
@abchatra
Copy link
Contributor

abchatra commented Aug 2, 2021

Code works on simulator. Issue is on hardware.

This requires edge-connector extension.

@PhilAtKitronik
Copy link
Author

The hardware design is taken from Microsoft Arcade shield reference design for the BBC micro:bit V2.
I have just tried to use the button for anything else like change the colour of the background the buttons work fine which suggests the hardware is fine.
it's only the edge connection blocks that affect it.

@abchatra
Copy link
Contributor

abchatra commented Aug 3, 2021

Sorry I didn't mean bug was in the hardware. This bug is reproduced on the hardware.

@PhilAtKitronik
Copy link
Author

any progress on this issue?

@dsssssssss9
Copy link

dsssssssss9 commented Aug 30, 2022

@abchatra
@pelikhan

Any News on this please ?

I have projects done in "Standard" MakeCode that i should like to enhance using MakeCode Arcade but Edge Connector Extension still exhibits the code locking problem

@abchatra abchatra added this to the Hotfix milestone milestone Nov 7, 2023
@JakeAtKitronik
Copy link

We are still encountering this issue with N3 based Arcades (Micro:bit based arcades). With the edge connector extension added to a project, and a block added to assign a pin high or low, although the resulting program will compile - the resulting program will lock up the arcade, with the screen remaining blank.

When the block to interface with the IO pin is added, there is a very brief error message within the Makecode Arcade interface:

IO Error in MakeCode Arcade

This would suggest that the Makecode Arcade backend has not been configured correctly to interact with the edge connector on N3 processors, despite being physically present on the reference design:
https://github.com/microsoft/pxt-arcade-hardware-designs/blob/master/microbit-shield/MicroBitArcadeShieldMVD%2008-1.1.PDF

As this ticket has been made back in 2021, I feel reluctant to believe that any action may be taken on this issue any time soon.

This an issue that has been spotted with both the official N3 processor option selected, as well as the experimental RP2040 support.

@tballmsft tballmsft assigned pelikhan and tballmsft and unassigned pelikhan Mar 20, 2024
@tballmsft
Copy link
Contributor

I believe this is because https://github.com/microsoft/pxt-arcade/blob/f05a119cd973e0282ef77053721cc380d47c5b25/libs/hw---n3/config.ts doesn't supply the needed pin mapping for the edge connector. I will investigate further.

@tballmsft
Copy link
Contributor

tballmsft commented Mar 21, 2024

here is program from top with config for N3 that edge connector extension needs ... will test when I get HW: https://makecode.com/_CuhapH58Vdbe

you need to select a micro:bit shield in order for this program to compile

@JakeAtKitronik
Copy link

Brilliant! This works perfectly! Thank you so much for looking into the issue :)

@tballmsft
Copy link
Contributor

Did it also resolve the problem you were seeing?

@JakeAtKitronik
Copy link

Yep, adding the definitions into our test script works as well

@JakeAtKitronik
Copy link

Also tweaking the provided code works for the RP2040 as well.

@tballmsft
Copy link
Contributor

OK. The fix I put it in is only for the N3. I can add for RP2040 as well. It will only be for the three big pins P0, P1, and P2

@tballmsft
Copy link
Contributor

actually, the mapping for RP2040 is in the bootloader. Can you change the mapping? @mmoskal ?

@mmoskal
Copy link
Member

mmoskal commented Mar 22, 2024

the bootloader is provided by console manufacturer (they ship a special "game" that has all the mappings in it)

@tballmsft
Copy link
Contributor

sorry, how does the mapping get incorporated then?

@mmoskal
Copy link
Member

mmoskal commented Mar 22, 2024

see here https://arcade.makecode.com/hardware/adding#r2

Manufacturer is supposed to provide a "recovery UF2" (which may contain a game) that has all the bootloader settings. That file can be created by using the sample UF2 linked from the page above, editing it using https://microsoft.github.io/uf2/patcher/ and concatenating it with game binary.

@JakeAtKitronik
Copy link

Aha! I didn't realise for the RP2040 you just needed to add it to the bootloader, I must of missed that.
Glad to know you just need to concatenate the demo game and the bootloader together as well!

@mmoskal
Copy link
Member

mmoskal commented Mar 25, 2024

Just to note, to concatenate you will need to update the block numbers, not just "cat" the files together.

This PR may be useful microsoft/uf2#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working extension hardware p2
Projects
None yet
Development

No branches or pull requests

7 participants