In revision 3e2ce45 examples/heartrate got extended, i.a. by implementing a heart rate value that changes over time using rand.Intn.
It seems, though, that in order to run examples/heartrate after this change on a micro:bit,
I have to replace rand.Intn by some other code (e.g. a constant, or some increasing integer);
then I am able to see the "tick" messages on the serial line, and I'm able to receive the values on a smartphone.
With rand.Intn, on the other hand, the program somehow freezes, printing fatal error:.
GDB shows nrf51.cpu -- clearing lockup after double fault, but I don't know if that is related.
rand.Intn uses sync.Mutex, I don't know if this might be a source of the problem.
When I use rand.Intn in a normal program on micro:bit, without softdevice, it works.
So, for instance, a small program like
func main() {
for {
println("rand", rand.Intn(20))
time.Sleep(time.Second)
}
}
works on plain micro:bit, but doesn't work on -target microbit-s110v8 - at least for me.
I think this is caused by calling the NVIC hardware peripheral directly instead of through the SoftDevice.
This is definitely a bug, but fixing it may be somewhat involved.
In revision 3e2ce45 examples/heartrate got extended, i.a. by implementing a heart rate value that changes over time using
rand.Intn
.It seems, though, that in order to run examples/heartrate after this change on a micro:bit, I have to replace
rand.Intn
by some other code (e.g. a constant, or some increasing integer); then I am able to see the "tick" messages on the serial line, and I'm able to receive the values on a smartphone.With
rand.Intn
, on the other hand, the program somehow freezes, printingfatal error:
.GDB shows
nrf51.cpu -- clearing lockup after double fault
, but I don't know if that is related.rand.Intn
usessync.Mutex
, I don't know if this might be a source of the problem.When I use rand.Intn in a normal program on micro:bit, without softdevice, it works. So, for instance, a small program like
works on plain micro:bit, but doesn't work on
-target microbit-s110v8
- at least for me.