micro:bit Troubleshooting

micro:bit Error Codes

micro:bit has a Hardware Errors Page to help when your micro:bit displays the following error codes:

010

Description

The micro:bit's I2C bus is not working, the device might be physically damaged.

Resolution

Check the micro:bit for any physical damage, ie a missing component. If this is the case, contact the reseller from which you purchased the micro:bit and ask about their replacement process or open a support ticket including a photograph of the front and rear of the device, the DETAILS.TXT file from the micro:bit and any information about the device and editor you are using to program it.

020

Description

There is no free memory on the micro:bit. Your program might be too complex or contain a lot of large variables.

Resolution

Try reducing your code by making functions out of large sections. If this does not fix the issue, try and find the shortest reproducer of the issue (the smallest bit of code that exhibits the problem) and create a support ticket with the program link or .hex file attached.

030

Description

Corruption detected in the micro:bit heap space (memory usually allocated for the storage of variables).

Resolution

Try flashing a different .hex file to your device and then try again. Look through your code for any issues.

040

Description

The micro:bit can't execute the script properly.

Resolution

Flash a different .hex file to it, then try flashing and running your previous program again. Look through your code for any issues.

042

Description

The micro:bit can't execute the script properly.

Resolution

Flash a different .hex file to it, then try flashing and running your previous program again. Look through your code for any issues.

043

Description

An error occurred with the micro:bit's radio component.

Resolution

Check the micro:bit for any physical damage, ie a missing component. If this is the case, contact the reseller from which you purchased the micro:bit and ask about their replacement process or open a support ticket.

050

Description

An error occurred with the micro:bit's accelerometer component.

Resolution

Check the micro:bit for any physical damage, ie a missing component. If this is the case, contact the reseller from which you purchased the micro:bit and ask about their replacement process or open a support ticket including a photograph of the front and rear of the device, the DETAILS.TXT file from the micro:bit and any information about the device and editor you are using to program it.

051

Description

An error occurred with the micro:bit's magnetometer component.

Resolution

Check the micro:bit for any physical damage, ie a missing component. If this is the case, contact the reseller from which you purchased the micro:bit and ask about their replacement process or open a support ticket including a photograph of the front and rear of the device, the DETAILS.TXT file from the micro:bit and any information about the device and editor you are using to program it.

098

micro:bit Other

The System LED Does Not Light Up When Powered from Batteries

According to micro:bit, this is normal behavior. The yellow system LED on the back of the micro:bit will not light up when only running from batteries.

The System LED is powered from the KL26 interface processor (the chip that manages the USB interface on the micro:bit), and this interface processor only powers up when the micro:bit is powered from the USB. When powered from batteries, the KL26 interface processor does not power up, and the System LED will not light up.

If you think there is an issue with the micro:bit, try the following:

If none of these steps help to solve your problem, it looks like your micro:bit might have developed a fault. You should get in contact with the company that you bought it from and check what their returns procedure is.

Description

Assertion failed. A MakeCode error that occurs when the condition in an assert was false.

Resolution

This is an error introduced through use of the assert function in MakeCode. See the example at https://makecode.microbit.org/reference/control/assert for usage.

Web Python Editor

The solutions to many micro:bit software issues, like the below, can be found on micro:bit's Software Support Page.

MicroPython Strange Rounding Error

Description

When I use floating point numbers, I get lots of digits displayed after a number (eg 18.9 gets displayed as 18.89999).

Cause

https://github.com/bbcmicrobit/micropython/issues/367#issuecomment-258059673ß

The micro:bit uses 30-bit floating point and 18.9 is parsed correctly/accurately but it's then rounded down to 18.899999 when stored in 30 bits.

Floating point numbers are always going to have inaccuracies and you should use formatting like "%.2f" if you want a certain number of digits in the output.

Workaround

From micro:bit:

number = 18.9

display.scroll("%.1f" % number)

My Hex Program Downloaded as an Unnamed File

Description

"Safari has a bug that means your work will be downloaded as an un-named file. Please rename it to something ending in .hex. Alternatively, use a browser such as Firefox or Chrome. They do not suffer from this bug" will appear in the python.microbit.org editor when you try to download a .Hex file using Safari on MacOS. The file will download, but will not have the .hex extension that the micro:bit needs to process the file and run the program.

Resolution

Rename the file, giving it the appropriate .hex extension or if you are able, use an alternative browser such as Firefox or Chrome that do not exhibit the bug.

My Python Program Downloaded as an Unnamed File

Description

"Safari has a bug that means your work will be downloaded as an un-named file. Please rename it to something ending in .py. Alternatively, use a browser such as Firefox or Chrome. They do not suffer from this bug." will appear in the python.microbit.org editor when you try to download a python script .py file using Safari on MacOS. The file will download, but will not have the .py extension that an editor needs to process the file.

Resolution

Rename the file, giving it the appropriate .py extension or if you are able, use an alternative browser such as Firefox or Chrome that do not exhibit the bug.

Oops! Your script is too long given the limited memory on the device.

Description

This error message will appear in the python.microbit.org editor if you try to download a hex file that contains too many lines of code.

Resolution

Reduce the amount of code in your program if you are able.

Sorry, we couldn't recognize this file

Description

This error message will appear in the python.microbit.org editor if the .hex file you are trying to load was created in another editor such as makecode.microbit.org, or in a different version of the python editor.

This article explains the same error in the MakeCode editor

Resolution

Load the .hex file in the editor in which it was created.

MakeCode Editor

The solutions to many micro:bit software issues, like the below, can be found on micro:bit's Software Support Page.

Sorry, We Couldn't Recognize this File

Description

This error message will appear in the makecode.microbit.org editor if the .hex file you are trying to load was created in another editor such as python.microbit.org.

Resolution

Load the .hex file in the editor in which it was created.

Oops, Don't Know How to Load this File

Description

This error message will appear in the makecode.microbit.org editor if the file you are trying to load does not have the required .hex file extension.

Resolution

Load a file that was created in MakeCode for micro:bit, that has a valid .hex extension

Network Request Failed

Description

This error message will appear in the makecode.microbit.org editor if the editor cannot connect to another cloud service, for example downloading an extension. The message might appear behind another window telling you that the extension is being downloaded. Sometimes this is due to the service throttling connections to prevent DoS attacks. See this issue on GitHub for further information.

Resolution

Program Error: r.isRef Is Not A Function

Description

This is a generic error that will appear in the makecode.microbit.org editor if there is an issue with the program when it is run thorough the simulator.

Resolution

These are hard to diagnose, but a common example is using a variable in your program that hasn't been declared. Check through your code and if you can't resolve it, open a support ticket attaching the link to the program or your .hex file.

Forever Runs Before OnStart Finishes

Description

My Forever loop starts before the OnStart has finished and I get runtime error 40 or 42, (NULL reference)

Resolution

Remove any statements in your On Start that pause.

Alternatively, if you need pauses in your On Start for some reason, at the end of your On Start set a boolean flag to True, and check the value of that flag in your Forever loops - only starting the Forever loop content once that boolean flag has been set to True.

Get more information on why this is here.