-
Notifications
You must be signed in to change notification settings - Fork 594
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
midi sad face 20 error #1281
Comments
Here is another example. Just Bluetooth, not MIDI. The attached zip contains three versions of the same project: original - created in January original - works as expected |
Where is the zip? |
@finneyj FYI |
Good point! A bit of a memory problem? |
Looks like pxt-bluetooth-midi has compilation issues against v1. investigating. |
We have
which means the macro at https://github.com/Microsoft/pxt-microbit/blob/20500fb9aea2d46c475402ab685b0e79bacb264f/libs/core/platform.h#L6 was not used. @mmoskal is platform.h properly included in microbit? |
Other extensions impacted: https://github.com/search?q=PXT_BUFFER_DATA&type=Code |
Looking into this |
@pelikhan I think this isn't just V1 related, as Martin's example suggests that something's up in V0 too. @machinehistories can you please confirm that you're using the 'live' version of makecode at makecode.microbit.org rather than the beta? Thanks |
I have similar issues with both the live version and the beta although when
I use the live version with midi bluetooth it will run the code, perform
some midi messages, and then produce 020 error at some point. If I use the
midi bluetooth on the beta site I can't even establish a recognized
bluetooth midi connection without getting an error. Hopefully that answers
your questions.
…On Mon, Sep 24, 2018 at 12:09 PM Jonathan Austin ***@***.***> wrote:
@pelikhan <https://github.com/pelikhan> I think this isn't just V1
related, as Martin's example suggests that something's up in V0 too.
@machinehistories <https://github.com/machinehistories> can you please
confirm that you're using the 'live' version of makecode at
makecode.microbit.org rather than the beta?
Thanks
Jonny
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1281 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZlqVLI7ONbhSp_KF1tgkbuytN6ZouZzks5ueS38gaJpZM4W1LBZ>
.
|
On v1, it does not even build so you get a broken program from MakeCode. I have a fix coming. |
There's two issues that are being mixed up here.
FOr the memory issue, what is Lancaster saying about memory pressure in DAL 2.1? |
Compile issue fixed and deployed 088c956 |
Thanks @pelikhan Since microbit-dal 2.1.0, we've moved to using a single heap memory allocator. Previously, dynamic memory allocation was split between the MicroBitHeapAllocator and the gcc/libc heap allocator. The reasons why are legacy. In 2.1.0, we move purely to the MicroBitHeapAllocator. There are two observations we noted from this.
The new allocator won't do that - it will protect whatever memory is reserved for the stack, and OOM with an 020 panic if memory is exhausted... So i suspect that's what's hapenning in these cases. Code that previously was unsafe and worked sometimes, is now being trapped as thus and prevented... @pelikhan If you remember, we tweaked the stack size for BLE builds in MakeCode recently to help ease these problems a little. Do you know if those changes will be applying to the code in this issue? |
hmm... looks like it is:
0x700 is a large GATT table size for a simple example though. That's probably using up about 1K more than is needed... I wonder if there's a way to reduce this in a way that's not too restricting. |
Right so in the past we maxed out the GATT table in order to support "all BLE services on" scenario. |
yep. The dal will reclaim any unused space though... |
So we were lucky in the past... |
The 020 error message pretty much is happening with the absolute simplest
of examples. In the past I could send rather lengthy code that used
bluetooth midi related instructions and it worked great. Based on what you
are now saying the bluetooth midi is essentially unusable since it errors
as soon as bluetooth is connected. Sounds like the previous solution was
great in so much as it worked. This is really too bad. For now if I at
least wanted to demo bluetooth midi in the classroom would I need to run an
older build and use local host. Unfortunately this makes future classroom
lessons rather difficult.
…On Mon, Sep 24, 2018 at 4:50 PM Peli de Halleux ***@***.***> wrote:
So we were lucky in the past...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1281 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZlqVPL6XWqqWHp5RALL5v0VxL4MKLF8ks5ueW-wgaJpZM4W1LBZ>
.
|
@pelikhan yes, I think so... @machinehistories I hear you. I'm just trying to explain the reasons here as a start point. We should look to resolve these issues of course... @pelikhan - my spidey sense tells me this is close to running. As a stopgap, is there a way to set the GATT table size differently for different packages? i.e. have the midi package set a small GATT table size in config.json than the "full" bluetooth package? |
@pelikhan would I expect changing the 'project settings' to include the following to help me debug?
(based on https://github.com/Microsoft/pxt-microbit/blob/master/libs/bluetooth/pxt.json#L23) I tried this on a little memory consumption program to see if I could see any difference and whether I use a gatt_table_size of 0x900 or 0x400 I don't see any difference in the results (BLE versus non BLE is huge though: ~1000 iterations to ~180!) And @finneyj if this does work I think we could enable heap debugging easily on a MakeCode project by the same method. Here's my attempt to characterise this https://makecode.microbit.org/_f8J5T6HtxLTV |
A package can override the gatt_table_size but there is no mechanism to handle clashing of multiple request. e.g. what if two packages request a different gatt size? do we take the max? |
If you have a YOTTA config flag for heap debugging, you could enable it from the pxt.json config section. |
For now I'm just trying to debug this - are you saying things set in the project settings should work then? Do you mind checking the URL above to see that I've done what you'd expect because they both seem to behave the same way (but then maybe my test fills stack not heap?) |
If you build locally with docker, you call look at the dockeryt folder. It contains the generated module.json... which is the ultimate truth about which flags ended being enabled in the config. |
The MIDI build issues covered. General memory consumption issues from BLE should be handled in the microbit-dal side. |
agree - let's track over there and see what we can do |
@machinehistories please don't consider the closure of the issue here on MakeCode as a suggestion we're not going to keep looking into this - it's just we need to move the issue to a different project to track it - as it's the DAL that can resolve the memory consumption issue (we may need MakeCode to update some parameters or settings once we've sorted out the right conditions, but we should debug at a DAL level). |
@machinehistories can you try this program and see if it works for you? It doesn't run out of memory as fast for me here (if I mash the buttons fast I can still trigger an 020) I can't actually test the midi side though! I'm testing using the nRF Go app, so it's a bit uncertain that it's a real case |
First off thanks for working on resolving this issue and I am very
appreciative for such a strong development team focused on the microbit. I
am in class all day and can't try out these programs until this evening.
Just to make sure I am running this tests properly so can you tell me which
firmware you'd like me to use and I am assuming all of these tests are
focused on the live build only. Please verify and I will try them out
tonight. thanks again, jason
…On Wed, Sep 26, 2018 at 7:22 PM Jonathan Austin ***@***.***> wrote:
@machinehistories <https://github.com/machinehistories> can you try this
program and see if it works for you? It doesn't run out of memory as fast
for me here (if I mash the buttons fast I can still trigger an 020)
https://makecode.microbit.org/_UHCE2EU8hhgs
I can't actually test the midi side though! I'm testing using the nRF Go
app, so it's a bit uncertain that it's a real case
If that doesn't work you can try this one, which is an absolutely tiny
stack, but doesn't modify the gatt table
https://makecode.microbit.org/_F0uhgEiu88tc
(it'll crash but not with an 020, probably)
These all have memory debugging enabled, so if you connect a terminal you
will be able to see the allocations as they happen.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1281 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZlqVKtjzWJjtnu53tFnCIblhd9nUBM2ks5ufDZngaJpZM4W1LBZ>
.
|
Hey, both of those links are good to compile against the live build, yes. I've modified the project settings to change the stack and heap size. It means they don't build as fast as normal (normally they're not rebulding the whole thing) so if it spins for a while before download give it time (up to a minute or two!) |
I tried them and I didn't have any luck. First off it was very difficult to
pair and get the midi recognized. When I managed to do it it immediately
gave the 020 error. I would say I had less success with these than I did
with the previous files. I was mainly trying to run this on windows 10
however I then tried on android but again I was unsuccessful in getting the
midi to run although I didn't get the 020 error.
Let me just say that previously, when this was all working, midi bluetooth
was great on both android and windows 10.
…On Thu, Sep 27, 2018 at 9:15 AM Jonathan Austin ***@***.***> wrote:
Hey, both of those links are good to compile against the live build, yes.
I've modified the project settings to change the stack and heap size. It
means they don't build as fast as normal (normally they're not rebulding
the whole thing) so if it spins for a while before download give it time
(up to a minute or two!)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1281 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZlqVOYudq4Fwo9-m4OsybCAVWv-oCvTks5ufPmugaJpZM4W1LBZ>
.
|
The way I am testing these is using midiberry on windows 10 |
This thread has been automatically locked since there has not been |
I am running midi bluetooth on the windows app and in the browser. This is code that worked in the past. Now it almost immediately gives the 20 error code after midi connection is made. I am running 0243 firmware.
microbit-midit (7).zip
The text was updated successfully, but these errors were encountered: