Skip to content

TinyGo example code causes Pico to frezze #5018

@Hangover1234

Description

@Hangover1234

I have tried running the example code for the max6675 temp sensor on a pi pico, resulting in the pico freezing and needing a reboot. I have tried changing the cables and switching the pico out, with no change.

Some simple troubleshooting showed, that the program hangs when it tries to read the sensor.
Getting desperate, i changed the SDI to SDO, with no luck.

In the following code, I have switched the pins from adafruit to pico

`func main() {
machine.GPIO17.Configure(machine.PinConfig{Mode: machine.PinOutput})
machine.GPIO17.High()

machine.SPI0.Configure(machine.SPIConfig{
    Frequency: 1_000_000,
    SCK:       machine.GPIO18,
    SDO:       machine.GPIO16,
})

thermocouple := max6675.NewDevice(machine.SPI0, machine.GPIO17)

for {
    temp, err := thermocouple.Read()

    if err != nil {
        println(err)
        return
    }
    println("%0.02f C : %0.02f F\n", temp, (temp*9/5)+32)
    time.Sleep(time.Second)
}

}`
Any ideas what could cause this in the example code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about usage of TinyGo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions