What are the overheads when switching to arm thumb assemby functions

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
rhubarbdog
Posts: 164
Joined: Tue Nov 07, 2017 11:45 pm

What are the overheads when switching to arm thumb assemby functions

Post by rhubarbdog » Thu Nov 29, 2018 1:03 am

Hi,
I've written a dht11 class, mainly in micropython. But the time critical section is in arm thumb assembly. I'm now reading 35 out of 40 bits. Before i wrote the assembly it was only about 12 to 17 bits.

The time it takes to switch from a write_digital pin to a read_digital one is only 500us
But that combined with a function call to my assembly I'm missing 5 bits.
What's the overhead switching between micropython and arm thumb assembler?

The last resort i have is trying to up the clock speed on my microbit, is that even possible?

PeterB
Posts: 1
Joined: Tue Apr 02, 2019 6:13 am

Re: What are the overheads when switching to arm thumb assemby functions

Post by PeterB » Tue Apr 02, 2019 6:18 am

I'm interested in using a DS18B20 (1wire) temperature sensor.
Can you factor out the 1wire part of the code?
This would then allow simpler wrappers in python to call the 1wire read and write.

Not sure if I'm up to doing it, but I might give it a go when school break comes (primary/elementary teacher).

rhubarbdog
Posts: 164
Joined: Tue Nov 07, 2017 11:45 pm

Re: What are the overheads when switching to arm thumb assemby functions

Post by rhubarbdog » Tue Apr 02, 2019 8:45 am

I don't think it's possible/practical to interact with a ds18b20 on a microbit.
The one wire protocol used in this DHT11 is custom. The comms for the ds18b20 is more complex. In the rest of micropython there's a library written in high level language.

The microbit is a small device my first attempt at DHT11 took all the available memory to compile and wouldn't run.

Post Reply