Search found 30 matches
- Wed Nov 25, 2015 10:55 pm
- Forum: Development of MicroPython
- Topic: Sharing variables between interrupt and normal code
- Replies: 15
- Views: 13621
Re: Sharing variables between interrupt and normal code
@pythoncoder, your observation is correct: The ldrex/strex mechanism does not depend on if the cpu is in IRQ mode or thread mode, it only tracks memory accesses. It is documented in this http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0403e.b/index.html (Registration required) documen...
- Tue Nov 24, 2015 8:01 am
- Forum: Development of MicroPython
- Topic: Sharing variables between interrupt and normal code
- Replies: 15
- Views: 13621
Re: Sharing variables between interrupt and normal code
First I want to say that I am not commenting on the specific example from pyhtoncoder. Only if using ldrex/strex can be a way to avoid disabling interrupts in the main thread. Although it seems to me that just disabling the interrupt is a whole lot less complex Yes, but it might lead to loosing data...
- Mon Nov 23, 2015 10:20 pm
- Forum: Development of MicroPython
- Topic: Sharing variables between interrupt and normal code
- Replies: 15
- Views: 13621
Re: Sharing variables between interrupt and normal code
You are absolutely right. But it is not always necessary to have atomic objects, it is often good enugh to have a notification in the main thread that an ISR has touched the object.
- Sun Nov 22, 2015 6:47 pm
- Forum: Development of MicroPython
- Topic: Sharing variables between interrupt and normal code
- Replies: 15
- Views: 13621
Re: Sharing variables between interrupt and normal code
ldrex does not lock the address, or more correctly the memory region, it activates some kind of hardware monitor. This monitor keeps track of any changes in the region done by an ISR or another process if there is a (RT)OS running. When strex is executed two things can happen. 1. No one has touched ...
- Sat Nov 21, 2015 5:07 pm
- Forum: Development of MicroPython
- Topic: Sharing variables between interrupt and normal code
- Replies: 15
- Views: 13621
Sharing variables between interrupt and normal code
This is a quite common topic in the forums. The common way to solve it is to disable interrupts while accessing shared variables from none interrupt mode (thread mode in ARM lingo). This can cause problems, one such example is discussed here https://github.com/micropython/micropython/issues/1555. I ...
- Sat Nov 07, 2015 8:51 am
- Forum: General Discussion and Questions
- Topic: CAN filters bug?
- Replies: 2
- Views: 3541
- Sun Nov 01, 2015 9:59 pm
- Forum: General Discussion and Questions
- Topic: CAN filters bug?
- Replies: 2
- Views: 3541
- Sun Nov 01, 2015 1:44 pm
- Forum: General Discussion and Questions
- Topic: Viper and return values
- Replies: 13
- Views: 11139
- Sun Nov 01, 2015 8:51 am
- Forum: General Discussion and Questions
- Topic: Viper and return values
- Replies: 13
- Views: 11139
Re: Viper and return values
Maybe I'm doing something wrong here, but if I store the code in a file (conv.py) and do.
I get the error when I use the native decorator but no error without it.
Code: Select all
import conv
conv.d(3,5)
- Sat Oct 31, 2015 6:09 pm
- Forum: General Discussion and Questions
- Topic: Viper and return values
- Replies: 13
- Views: 11139
Re: Viper and return values
Using @micropython.native like import math import sys L=220 R=170.0/2 K = (R/2*1.7320508075688772)**2 Rh = R/2 Lsq = L * L @micropython.native def d(x ,y): yplusK = y+K Az = math.sqrt(Lsq - (x)**2 - (y-R)**2) Bz = math.sqrt(Lsq - (x-Rh)**2 - yplusK) Cz = math.sqrt(Lsq - (x+Rh)**2 - yplusK) return (A...