Weird behaviour when using ws2812

Hello!

I’m on Sipeed Dock M1W and trying to use ws2812 package and its acting weirdly. Below is the code and output for main.py.

Code:

print("main.py")
from modules import ws2812

try:
    ws = ws2812(5,6)
    ws.set_led(0, (0,0,0))
    ws.set_led(1, (200,0,200))
    ws.set_led(2, (0,0,0))
    ws.set_led(3, (100,100,0))
    ws.set_led(4, (0,0,0))
    ws.set_led(5, (50,50,50))
    ws.display()
    print("leds init")
except Exception as error:
    print(str(error))

Output:

[MAIXPY] Pll0:freq:806000000
[MAIXPY] Pll1:freq:398666666
[MAIXPY] Pll2:freq:45066666
[MAIXPY] cpu:freq:403000000
[MAIXPY] kpu:freq:398666666
[MAIXPY] Flash:0xef:0x17
[MaixPy] gc heap=0x802fee80-0x8037ee80(524288)
[MaixPy] init end

 __  __              _____  __   __  _____   __     __
|  \/  |     /\     |_   _| \ \ / / |  __ \  \ \   / /
| \  / |    /  \      | |    \ V /  | |__) |  \ \_/ /
| |\/| |   / /\ \     | |     > <   |  ___/    \   /
| |  | |  / ____ \   _| |_   / . \  | |         | |
|_|  |_| /_/    \_\ |_____| /_/ \_\ |_|         |_|

Official Site : https://www.sipeed.com
Wiki          : https://maixpy.sipeed.com

main.0␀

Though it does set the leds correctly, it doesn’t fully print main.py and also gets stuck and doesn’t drop to python shell. Without ws2812 package, the script works properly with just print statement in main.py and also drops to python shell to be able to type in any further commands.

Code:

print("main.py")

Output:

[MAIXPY] Pll0:freq:806000000
[MAIXPY] Pll1:freq:398666666
[MAIXPY] Pll2:freq:45066666
[MAIXPY] cpu:freq:403000000
[MAIXPY] kpu:freq:398666666
[MAIXPY] Flash:0xef:0x17
[MaixPy] gc heap=0x802fee80-0x8037ee80(524288)
[MaixPy] init end

 __  __              _____  __   __  _____   __     __
|  \/  |     /\     |_   _| \ \ / / |  __ \  \ \   / /
| \  / |    /  \      | |    \ V /  | |__) |  \ \_/ /
| |\/| |   / /\ \     | |     > <   |  ___/    \   /
| |  | |  / ____ \   _| |_   / . \  | |         | |
|_|  |_| /_/    \_\ |_____| /_/ \_\ |_|         |_|

Official Site : https://www.sipeed.com
Wiki          : https://maixpy.sipeed.com

main.py
MicroPython v0.6.2-19-ga2ef4711e on 2021-01-27; Sipeed_M1 with kendryte-k210
Type "help()" for more information.
>>> [maixpy] mount sdcard failed

>>>

This is turning out to be an issue when trying to use ws2812 package with other scripts, as any debug prints statements from other scripts just prints out random garbage. Also to be sure, I’ve tried two firmwares: maixpy_v0.6.2_15_g0118a9a77.bin and maixpy_v0.6.2_19_ga2ef4711e.bin and same issue on both.

Is anybody else facing this issue? Can someone help me resolve this? Thank you :slight_smile: