Search found 74 matches

by ttmetro
Sun Jun 14, 2020 4:59 am
Forum: Other Boards
Topic: STM32 USB
Replies: 5
Views: 562

Re: STM32 USB

ttmetro wrote:
Sat Jun 13, 2020 5:28 pm

Code: Select all

#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
This line needs to be

Code: Select all

#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV4)
Then all is well!
by ttmetro
Sat Jun 13, 2020 8:48 pm
Forum: Other Boards
Topic: STM32 USB
Replies: 5
Views: 562

Re: STM32 USB

What kind of board is this? Does it have a ST Link interface, maybe? Do you have MICROPY_HW_ENABLE_USB enabled? Yes, also MICROPY_HW_USB_FS. MICROPY_HW_USB_VBUS_DETECT_PIN and MICROPY_HW_USB_OTG_ID_PIN are not defined since they are not connected to the usb port. I inadvertently have an LED on PA9 ...
by ttmetro
Sat Jun 13, 2020 8:44 pm
Forum: Other Boards
Topic: STM32 USB
Replies: 5
Views: 562

Re: STM32 USB

This is a custom board with an STM32F401CEU cpu (uqfn48 package) and minimal additional hardware: - no SDLink - an 8MHz crystal with 20pF loads, - the aforementioned USB connector with just DP and DN connected to the cpu, - Boot1 tied to gnd - Boot0 0 or 1 to put into DFU mode - a few GPIO pins wire...
by ttmetro
Sat Jun 13, 2020 5:28 pm
Forum: Other Boards
Topic: STM32 USB
Replies: 5
Views: 562

STM32 USB

I have a custom board with an STM32F401. I can flash micropython with DFU, but cannot connect to the REPL over USB (the computer - a MAC - won't even "see" the USB port). The wiring of the USB connector could be the problem: only DP (1.5k pullup to 3.3V) and DM are connected (and 5V). ID is NC (and ...
by ttmetro
Sat Dec 07, 2019 7:44 pm
Forum: Programs, Libraries and Tools
Topic: datetime / localtime
Replies: 12
Views: 1857

Re: datetime / localtime

Trouble is that although sensible, this change could break existing code. Hence we are stuck with it, at least until MicroPython 2.0.
by ttmetro
Sat Dec 07, 2019 5:46 pm
Forum: Programs, Libraries and Tools
Topic: datetime / localtime
Replies: 12
Views: 1857

Re: datetime / localtime

Thanks! Indeed an unfortunate discrepancy.
by ttmetro
Fri Dec 06, 2019 6:31 am
Forum: Programs, Libraries and Tools
Topic: datetime / localtime
Replies: 12
Views: 1857

datetime / localtime

On an ESP32 with generic v1.11 micropython I get what appears (to me) to be an inconsistency with time: import time from machine import RTC def date(st): print("{:4}-{:2}-{:02d} {:2}:{:02d}:{:02d}".format( \ st[0], st[1], st[2], st[3], st[4], st[5])) st = (2019, 12, 6, 6, 20, 53, 4, 340) RTC().datet...
by ttmetro
Thu Jul 25, 2019 4:18 pm
Forum: Development of MicroPython
Topic: Check signature of handler
Replies: 2
Views: 687

Re: Check signature of handler

Thanks. What I actually did is forward everything that's written to stdout to the handler. The exception prints the error message - and results in an infinite loop.

Confused myself; should have tried a simpler example (like what I posted).
by ttmetro
Wed Jul 24, 2019 5:22 pm
Forum: Development of MicroPython
Topic: Check signature of handler
Replies: 2
Views: 687

Check signature of handler

How do I check the signature of a function? I define it in Python def handler_function(arg1, arg2): pass and then call it with the following C code: mp_call_function_2(handler_function, arg1, arg2) This works well, but crashes the VM if the handler function is not declared with the correct signature...
by ttmetro
Tue Mar 05, 2019 12:32 am
Forum: General Discussion and Questions
Topic: Dynamically add method to instance
Replies: 7
Views: 1241

Re: Dynamically add method to instance

Yes, that's what I want: from types import MethodType class DynamicTest: def __init__(self): self.x = 5 def a(self): return self.x dt = DynamicTest() def b(self): return self.x dt.b = b def c(self): return self.x setattr(dt, 'c', MethodType(c, dt)) print('a', dt.a()) # print('b', dt.b()) print('c', ...