tonygilkerson / mbx-iot

Mail Monitor an IoT project to monitor mail delivery
0 stars 0 forks source link

Lora Upgrade Issue - prints "p" then locks up #5

Open tonygilkerson opened 1 year ago

tonygilkerson commented 1 year ago

I am working with Lora sx127x on a Pico, when I upgraded to v0.28.0 things started to work. But today after I upgraded to v0.28.1 I am no longer able to Tx or Rx. It will find the radio but as soon as I start to Tx or Rx it prints p and locks up (i assume it is printing panic but does not get that far. The 10 second Rx loop work as long as it does not receive any data, but as soon as I send data with another device it locks up.

Patricio Whittingslow

See this slack thread

Patricio Whittingslow 2 months ago So I tested my SX1278 and found d01d859 did indeed introduce the breaking change. :pensive:

$ git bisect good
d01d85930d19a73010853b7ba8648d8811891bee is the first bad commit
commit d01d85930d19a73010853b7ba8648d8811891bee
Author: soypat <graded.sp@gmail.com>
Date:   Sun Jun 11 15:03:45 2023 -0300

    rp2040: add spi busy waits on read and read/write transactions

 src/machine/machine_rp2040_spi.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Code

The addition of this code seems to cause the issue: Source file /Users/tgilkerson/github/tinygo-org/tinygo/src/machine/machine_rp2040_spi.go

    for spi.isBusy() {
        gosched()
    }

Solution

See if you can run TinyGo from the dev branch and remove this lines until the upstream is fix

To run from dev I think I would do something like this:

tonygilkerson commented 1 year ago

I got a response on the Tinygo slack channel: https://gophers.slack.com/archives/CDJD3SUP6/p1692660961082699?thread_ts=1692660743.478199&cid=CDJD3SUP6

tonygilkerson commented 1 year ago

Workaround

I remove the "bad" code on the Tinygo dev branch:

ln -s /Users/tgilkerson/go/bin/tinygo /usr/local/bin/tinygo
tonygilkerson commented 1 year ago

Workaround Take II

# Make sure you have `pico` selected as the TinyGo target
# and the vscode is working then run the following
code  $(jq -r  '.["go.toolsEnvVars"].GOROOT' .vscode/settings.json)/src/machine/machine_rp2040_spi.go 

# Comment out the two occurrences of the following and save
    for spi.isBusy() {
        gosched()
    }