Neotron-Compute / Neotron-Pico-BIOS

BIOS for the Neotron Pico
GNU General Public License v3.0
15 stars 5 forks source link

Unreliable startup #49

Closed thejpster closed 1 year ago

thejpster commented 1 year ago

When flashing the RP2040 with probe-run I observe a couple of different outcomes:

Start-up beeps

  1. You get all the start-up beeps
  2. You get some of the beeps (often every other beep), and some errors:
WARN  Error executing Request { request_type: ShortWriteAlt, register: 114, length_or_data: 116, crc: 243 }: Decoding Error BadResponseResult [0, 0]
└─ neotron_pico_bios::{impl#1}::bmc_do_request @ src/main.rs:933
WARN  Error executing Request { request_type: ShortWriteAlt, register: 114, length_or_data: 97, crc: 152 }: Decoding Error BadResponseResult [0, 0]
└─ neotron_pico_bios::{impl#1}::bmc_do_request @ src/main.rs:933

You seem to be able to trigger case (2) by using DEFMT_LOG=info. My default of DEFMT_LOG=debug gets you case (1).

Keyboard

  1. Usually the keyboard does not work. The BIOS enters "power_idle" and never comes out.
  2. Sometimes it starts up and prints an infinite number of "Interrupts: 0b00000000" messages.
  3. Doing a Reset usually makes the keyboard work, but there's no defmt logs.
jonathanpallant commented 1 year ago

Maybe we should be more robust about our start-up process.

  1. Disable all interrupts
  2. Ensure Core 1 is stopped/waiting
  3. Reset the NVIC state
  4. Reset each peripheral as we bring it up
jonathanpallant commented 1 year ago

I suppose that after an RP2040 debug reset, the reset of the PCB has not been reset, including the MCP23S17. So maybe that needs to be put into a reset start on start-up.

jonathanpallant commented 1 year ago

Replacing wfi with 1,000,000 nops makes everything work again. The the issue is probably setting up the SIO and/or NVIC to generate interrupts when the IRQ input changes.

I have a Picoscope capture where the IRQ input to the RP2040 goes low and nothing happens.

jannic commented 1 year ago

Does it work reliably after a power cycle? I'm suspecting that the reset done after flashing only resets parts of the chip.

thejpster commented 1 year ago

So I forgot to enable interrupts. And it was wfe not wfi, so that mattered.