← index #18282Issue #16211
Off-topic · high · value 3.258
QUERY · ISSUE

File Encoding / SyntaxError Problem with Arduino Opta and MicroPython

openby elvisaviopened 2025-10-15updated 2025-10-15
bug

Port, board and/or hardware

OPTA RS485

MicroPython version

Device: Arduino Opta RS485

MicroPython version: v1.26.1 (2025-09-11)

Flashed file: ARDUINO_OPTA-20250911-v1.26.1.dfu

Tools used: Thonny and mpremote

Installation method:Dfu-utils and Arduino’s official MicroPython installer (same result)

Reproduction

  • Reset the Opta’s memory using the example sketch QSPIFormat from the Arduino IDE.

  • Flash the latest .dfu file:

ARDUINO_OPTA-20250911-v1.26.1.dfu

  • Disconnect and connect Usb cable
  • Connect using Thonny or mpremote.

Every time I connect, I immediately see this error:

Traceback (most recent call last):
File "boot.py", line 3
SyntaxError: invalid syntax
MicroPython v1.26.1 on 2025-09-11; Arduino OPTA with STM32H747
Type "help()" for more information.

Expected behaviour

No response

Observed behaviour

I noticed that boot.py and main.py are always corrupted or encoded incorrectly after flashing.
Example of what boot.py looks like:

boot.py -- run on boot to configure USB and filesystem

Put app code in main®xù

ŠÂ^MŠéíøïúü¨íéëè...

I tried manually reformatting the flash memory:

import os, vfs, pyb
vfs.umount('/flash')
vfs.VfsFat.mkfs(pyb.Flash(start=0))
vfs.mount(pyb.Flash(start=0), '/flash')
os.chdir('/flash')

Then recreated a simple boot.py:

simple boot

print("BOOT OK")

After reset, this works fine:

BOOT OK
MicroPython v1.26.1 on 2025-09-11; Arduino OPTA with STM32H747

But when I upload a new main.py (even a simple one):

import time
print("start program")

for i in range(1, 100):
print(f"N Message: {i}")
time.sleep(1)

print("End program")

…the file becomes corrupted and unreadable:

import time
print("start pzográm"©ŠŠëïýîüíú¨½¨...

Then after reset:

BOOT OK
Traceback (most recent call last):
File "main.py", line 2
SyntaxError: invalid syntax

Additional Information

  • The issue seems to be related to filesystem encoding or corruption after writing .py files.

  • It happens both with Thonny and mpremote.

  • I’ve confirmed the .dfu flash completes successfully each time.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Input Pins 1 and 2 do not work of the 8

openby magliaralopened 2024-11-11updated 2026-03-24
bugport-stm32

Port, board and/or hardware

ARDUINO_OPTA

MicroPython version

MicroPython v1.24.0 on 2024-10-25; Arduino OPTA with STM32H747

Reproduction

import machine
from machine import Pin

pin1 = Pin("IN_1")
pin1.value()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'value'

pin1.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=self._callback)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'irq'

pin2 = Pin("IN_2")
pin2.value()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'value'

pin2.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=self._callback)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'irq'

Expected behaviour

pin3 = Pin("IN_3")
pin3.value()
0

Observed behaviour

Pin 1 and 2 do not work.
It seems that the pin 1 and 2 are not instantiated correctly. Whether with IN_1 or PA0_C.
Pins 3 to 8 work both ways.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied