[Microbit-Python] Lock-up due to some combination of radio and pwm.

Nicholas H.Tollervey ntoll at ntoll.org
Tue Feb 14 13:21:57 EST 2017


It's fixed in MicroPython but hasn't made it's way into uflash (and thus
Mu). It'll be in the next release of these tools.

N.

On 14/02/17 18:08, Nevil Hunt wrote:
> Hi Nicholas/Damien/David,
> 
> 
> I notice on GitHub Issue [#392] 'microbit hangs when using radio and
> PWM' is now closed.
> 
> 
> I've just tried with mu-0.9.13 but still get the same lock-up.
> 
> Is it that the issue [#392] fix hasn't found its way into Mu yet (in
> which case I'll check it again when the next version of Mu is released)
> or is the bug still there?
> 
> 
> 
> Cheers,
> 
> 
> Nevil
> 
> 
> 
> 
> ------------------------------------------------------------------------
> *From:* Nicholas H.Tollervey <ntoll at ntoll.org>
> *Sent:* 27 January 2017 11:04
> *To:* For Pythonic MicroBit related discussions; Nevil Hunt
> *Cc:* David Booth
> *Subject:* Re: [Microbit-Python] Lock-up due to some combination of
> radio and pwm.
>  
> Hi,
> 
> I'm hope to have a release of the editors with an updated runtime come
> out relatively soon. Unfortunately, it's a case of lining things up and
> making sure everything is ready / tested and those people I'm relying on
> to do something actually do it.
> 
> N.
> 
> On 27/01/17 10:27, David Booth via Microbit wrote:
>> Hi Nevil, Damien, Mark
>> 
>> Re Micro Python lock up when Radio and PWM output used on micro:bit.
>> 
>> Damien found that my firmware was out of date and sent me a fix which
>> involved merging two hex file.  Unfortunately my programming skills were
>> not up to performing this merger and so David Whale sent me this idiots
>> guide (me) to producing a microPython editor on my PC screen which
>> incorporated Damien's fix but enabled me to write any microPython script
>> as I would in the editor I would have got via microbit.org
>> <http://microbit.org>. This solution written by Nicholas Tollervey is
> 
> The Micro:bit Foundation is a global non-profit ... <http://microbit.org/>
> microbit.org
> You will need your BBC micro:bit to help avert disaster, defeat the
> Daleks and regain control of the TARDIS
> 
> 
> 
>> given at the end of this email.  This worked. So I recommend you follow
>> the instructions but remember if you do not update your new editor, over
>> time it might get out of date again.
>> 
>> *Question for Damien*
>> *
>> *
>> *For people like me with older micro:bits and poor C skills, will there
>> come a time when linking into the microPython editor via
>> www.microbit.org <http://www.microbit.org> <http://www.microbit.org>
> will give them an editor that
> 
> The Micro:bit Foundation is a global non-profit ...
> <http://www.microbit.org/>
> www.microbit.org
> You will need your BBC micro:bit to help avert disaster, defeat the
> Daleks and regain control of the TARDIS
> 
> 
> The Micro:bit Foundation is a global non-profit ...
> <http://www.microbit.org/>
> www.microbit.org
> You will need your BBC micro:bit to help avert disaster, defeat the
> Daleks and regain control of the TARDIS
> 
> 
> 
>> will by-pass this problem or should the microPython documentation warn
>> them that if they want to use radio and PWM to use the following procedure?*
>> *
>> *
>> Regarding Ticket 583  https://support.microbit.org/helpdesk/tickets/583
>> <https://support.microbit.org/helpdesk/tickets/583>
>> 
>> Ok, so I have a simple scheme for how you can fix this, the idea came
>> from Nicholas Tollervey late last night!
>> 
>> 1. go to: https://github.com/bbcmicrobit/PythonEditor
> 
> <https://github.com/bbcmicrobit/PythonEditor>
> 	
> GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ...
> <https://github.com/bbcmicrobit/PythonEditor>
> github.com
> PythonEditor - A MicroPython editor for the BBC micro:bit that works
> with browsers.
> 
> 
> 
>> <https://github.com/bbcmicrobit/PythonEditor>
> 
> <https://github.com/bbcmicrobit/PythonEditor>
> 	
> GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ...
> <https://github.com/bbcmicrobit/PythonEditor>
> github.com
> PythonEditor - A MicroPython editor for the BBC micro:bit that works
> with browsers.
> 
> 
> 
>> 
>> 2. press the CLONE OR DOWNLOAD button
>> 
>> 3. Choose the DOWNLOAD ZIP option
>> 
>> This will download a complete web based python editor.
>> 
>> 4. Unzip this on your computer - you should now have a PythonEditor folder
>> 
>> 5. get Damien's patched .hex file from
>> here: https://micropython.org/resources/firmware/microbit-micropython.hex
> <https://micropython.org/resources/firmware/microbit-micropython.hex>
>> 
>> 6. rename Damien's .hex file as 'firmware.hex' and replace the
>> firmware.hex that is in the PythonEditor directory that is now on your
>> computer with this patched version.
>> 
>> 7.  double click on editor.html - this should launch a complete python
>> editor web page in your browser.
>> 
>> 8. Paste your code into this editor window, then press the DOWNLOAD
>> button. This will generate a .hex file that has your script and Damien's
>> latest MicroPython 'firmware' inside it (which apparently has the PWM
>> fix inside it that he was talking about)
>> 
>> 9. Test your code again to see if the PWM lasts for longer, and report
>> back to us on how this goes?
>> 
>> Hope this helps!
>> 
>> 
>> 
>> David Whale
>> micro:bit support
>> http://microbit.org/team
> 
> The Micro:bit Foundation is a global non-profit ...
> <http://microbit.org/team>
> microbit.org
> We are enabling children around the world to get creative with
> technology and invent in school, in clubs and at home! The micro:bit is
> a handheld, fully programmable ...
> 
> 
> 
>> 
>> 
>> On 26 January 2017 at 18:14, Nevil Hunt <nevil.hunt at hotmail.co.uk
>> <mailto:nevil.hunt at hotmail.co.uk>> wrote:
>> 
>>     Hi David/Mark/Damien,
>> 
>> 
>>     Are there any updates on this lock-up issue?
>> 
>> 
>>     By the way if you or anyone else on this mailing list is at the BETT
>>     Show tomorrow (Friday) then I will be on the micro:bit stand for at
>>     least part of the day so come over and say 'hello'!
>> 
>> 
>>     Cheers,
>> 
>> 
>>     Nevil
>> 
>> 
>> 
>>     ------------------------------------------------------------------------
>>     *From:* Microbit
>>     <microbit-bounces+nevil.hunt=hotmail.co.uk at python.org
>>     <mailto:hotmail.co.uk at python.org>> on behalf of David Booth via
>>     Microbit <microbit at python.org <mailto:microbit at python.org>>
>>     *Sent:* 31 December 2016 23:17
>>     *To:* For Pythonic MicroBit related discussions
>>     *Cc:* David Booth
>>     *Subject:* Re: [Microbit-Python] Lock-up due to some combination of
>>     radio and pwm.
>>      
>>     Hi Mark
>>     I have been having problems getting github to accept my input.  It
>>     keeps asking me to verify my email address which I have done several
>>     times.  So I have now re registered and submitted a comment.  
>>     However it did not let me send .hex or .py files
>> 
>>     However you should know that in the interim Damien George has my hex
>>     files and has reproduced the problem.  I have sent him my .py files
>>     so he can investigate further.
>> 
>>     Happy New Year
>>     David
>> 
>>     On 30 December 2016 at 12:04, Mark Shannon <mark at hotpy.org
>>     <mailto:mark at hotpy.org>> wrote:
>> 
>>         Hi Nevil and David,
>> 
>>         Could you please submit an issue for this.
>>         https://github.com/bbcmicrobit/micropython/issues/new
>>         <https://github.com/bbcmicrobit/micropython/issues/new>
>> 
>>         It is frustrating knowing that there may be a problem, but not
>>         being able to fix it.
>>         All I need is a brief description of what goes wrong and, most
>>         importantly, some code that causes the problem.
>> 
>>         Cheers,
>>         Mark.
>> 
>>         On 23/12/16 18:44, Nevil Hunt wrote:
>> 
>>             Hi David,
>> 
>> 
>>             I've also encountered some similar symptoms this week, namely a
>>             micro:bit locking up such that a reset doesn't bring it back
>>             to life.
>>             Only a power cycle brings it back to life.
>> 
>> 
>>             My set-up has some similarities with yours in that I'm
>>             sending Radio
>>             commands from one micro:bit to another using the suggested
>>             method of
>>             "radio.send(str(x))" with the receiving micro:bit locking up
>>             from time
>>             to time. However I think the lockups might not be due to the
>>             Radio
>>             commands. I too have the receiving micro:bit driving pins
>>             with PWM (in
>>             my case Servos) and with a bit of experimenting it looks
>>             like it might
>>             be these "pin1.write_analog(x_angle)" commands that are
>>             causing the
>>             lock-ups since by commenting out these "write_analog"
>>             commands (but with
>>             all the Radio commands still running) it hasn't locked up in
>>             over an
>>             hour. By comparison, with the "write_analog" commands still
>>             active, ~5
>>             mins is the longest it runs without locking up.
>> 
>> 
>>             Maybe you could see if commenting out the "write_analog"
>>             commands on
>>             your setup has the same effects. It may not stop other
>>             errors but I'd be
>>             interested to see if it stops the lock-ups.
>> 
>> 
>> 
>>             Cheers,
>> 
>> 
>>             Nevil
>> 
>> 
>> 
>> 
>>             ------------------------------------------------------------------------
>>             *From:* Microbit
>>             <microbit-bounces+nevil.hunt=hotmail.co.uk at python.org
>>             <mailto:hotmail.co.uk at python.org>>
>>             on behalf of David Booth via Microbit <microbit at python.org
>>             <mailto:microbit at python.org>>
>>             *Sent:* 23 December 2016 15:09
>>             *To:* For Pythonic MicroBit related discussions
>>             *Cc:* David Booth
>>             *Subject:* Re: [Microbit-Python] List of error codes and
>>             their meanings
>> 
>>             Hi Damien
>> 
>>             I have a related question regarding run time errors in micro
>>             Python.
>> 
>>             I have three micro:bits. The first I call Rx because it
>>             basically
>>             receives x axis acceleration data in string form, via the
>>             radio from the
>>             other two micro:bits Tx1 and Tx2.  Rx poles Tx1 then Tx2
>>             with 100 ms
>>             gaps. Nicholas Tollervey showed me how to avoid the Type
>>             None error when
>>             converting the string to an integer in RX and I now have
>>             three simple
>>             script which enable Rx to drive pins P0 (from Tx1) and P8
>>             (from Tx2)
>>             with a PWM signal.
>> 
>>             However after running perfectly well for anything from 10
>>             seconds to a
>>             minute Rx freezes. On the very few occasions an error
>>             message has
>>             scrolled it appears to be saying that "received is not a
>>             string" and
>>             possibly there is a value error.  However on 98% of
>>             occasions Rx is
>>             frozen to the extent it cannot report the error. Since
>>             spurious errors
>>             do not worry me, provided Rx continues with the polling
>>             loop, is it
>>             possible to suppress catching run time errors and if it is
>>             possible is
>>             it likely that the While loop would continue?
>> 
>>             Sometimes pressing reset restarts the system but sometimes I
>>             have to
>>             remove the battery.
>> 
>>             Thank you  and a Happy Christmas
>>             David Booth
>>             ps will you be at BETT?
>> 
>> 
>>             On 20 December 2016 at 23:31, Damien George
>>             <damien.p.george at gmail.com <mailto:damien.p.george at gmail.com>
>>             <mailto:damien.p.george at gmail.com
>>             <mailto:damien.p.george at gmail.com>>> wrote:
>> 
>>                 There are many exceptions and they can occur for many
>>             reasons.  Almost
>>                 all are based on CPython and the exceptions form a
>>             hierarchy.  Eg,
>>                 indexing a list with an out-of-bounds index will raise
>>             IndexError,
>>                 which derives from LookupError, which derives from
>>             Exception, which
>>                 derives from BaseException.
>> 
>>                 For a list of implemented exceptions in MicroPython see
>>                
>>             https://github.com/bbcmicrobit/micropython/blob/master/source/py/objexcept.c#L192-L280
>>             <https://github.com/bbcmicrobit/micropython/blob/master/source/py/objexcept.c#L192-L280>
>>                
>>             <https://github.com/bbcmicrobit/micropython/blob/master/source/py/objexcept.c#L192-L280
>>             <https://github.com/bbcmicrobit/micropython/blob/master/source/py/objexcept.c#L192-L280>>
>> 
>>                 On 21 December 2016 at 08:35, David Whale
>>                 <david at thinkingbinaries.com
>>             <mailto:david at thinkingbinaries.com>
>>             <mailto:david at thinkingbinaries.com
>>             <mailto:david at thinkingbinaries.com>>> wrote:
>>                 > Is there anything in the docs that lists all the errors
>>                 (exceptions) that
>>                 > can occur in MicroPython and what they mean?
>>                 >
>>                 > The closest I found was this:
>>                 >
>>                 >
>>                
>>             https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h
>>             <https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h>
>>                
>>             <https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h
>>             <https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h>>
>>                 >
>>                 >
>>                 > Thanks
>>                 >
>>                 > David
>>                 >
>>                 > microbit.org-ticket: 460
>>                 >
>>                 >
>>                 >
>>                 > _______________________________________________
>>                 > Microbit mailing list
>>                 > Microbit at python.org <mailto:Microbit at python.org>
>>             <mailto:Microbit at python.org <mailto:Microbit at python.org>>
>>                 > https://mail.python.org/mailman/listinfo/microbit
>>             <https://mail.python.org/mailman/listinfo/microbit>
>>                 <https://mail.python.org/mailman/listinfo/microbit
>>             <https://mail.python.org/mailman/listinfo/microbit>>
>>                 >
>>                 _______________________________________________
>>                 Microbit mailing list
>>                 Microbit at python.org <mailto:Microbit at python.org>
>>             <mailto:Microbit at python.org <mailto:Microbit at python.org>>
>>                 https://mail.python.org/mailman/listinfo/microbit
>>             <https://mail.python.org/mailman/listinfo/microbit>
>>                 <https://mail.python.org/mailman/listinfo/microbit
>>             <https://mail.python.org/mailman/listinfo/microbit>>
>> 
>> 
>> 
>> 
>>             _______________________________________________
>>             Microbit mailing list
>>             Microbit at python.org <mailto:Microbit at python.org>
>>             https://mail.python.org/mailman/listinfo/microbit
>>             <https://mail.python.org/mailman/listinfo/microbit>
>> 
>>         _______________________________________________
>>         Microbit mailing list
>>         Microbit at python.org <mailto:Microbit at python.org>
>>         https://mail.python.org/mailman/listinfo/microbit
>>         <https://mail.python.org/mailman/listinfo/microbit>
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Microbit mailing list
>> Microbit at python.org
>> https://mail.python.org/mailman/listinfo/microbit
>> 
> 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/microbit/attachments/20170214/31f61e84/attachment.sig>


More information about the Microbit mailing list