Path: ...!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Michael Schwingen Newsgroups: comp.sys.raspberry-pi Subject: Re: Need help with PI PICO... Date: 24 Mar 2024 13:31:48 GMT Lines: 46 Message-ID: References: <20240323183723.b2902fb94d75422b924c1bc7@eircom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net kaJ7ldRYxSEvZ7Ygu8MCmg0JvPhgJpakAFOa+5CjTxlY+P0mRV Cancel-Lock: sha1:NsN4PaNAZzQsdgcpzMGMIDI5aNY= sha256:8AbHCD6qKV82c+eZcl3+hd86VKiG2b/F8nXlJtWj0J4= User-Agent: slrn/1.0.3 (Linux) Bytes: 2637 On 2024-03-23, The Natural Philosopher wrote: > My choice tree is between the GPIO out signal never being received by > the ultrasonic module, or the GPIO in signal is being missed by the Pi > PICO on account of possibly some interrupt masking its appearance until > it is too late and its gone low again. Or there never is a signal on the module output. You should write your code to cope with such problems - sample code/libraries often skips the error handling, but that does not mean *you* can if you want reliable operation. Hook up an oscilloscope or logic analyzer to check what is the case. A cheap 8-channel USB logic analyzer is a great tool to have around when working bare metal: https://www.aliexpress.com/item/1005005993277484.html Using the Saleae software on these is *not* allowed by the license, but sigrok/pulseview work great: https://sigrok.org/ > We are running bare metal-ish here. > Back in the day I would have used a chip emulator with hardware break > points. > And a cost of hundreds of thousands. Nowadays, you would use a SWD debugger, since the debug/emulation logic is already integrated in the RP2040! Something like the JTAG Hat on a Raspberry PI: https://www.schwingen.org/jtag-hat/ or any SWD probe supported by OpenOCD (FTDI, CMSIS-DAP work fine), like the Raspberry Pi Debug Probe (which works for the RP2040, but lacks reset signals and support for voltages other than 3.3V): https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html That sets you back about 20€, and gives you instant breakpoint/single step operation with full view of registers and memory contents. cu Michael -- Some people have no respect of age unless it is bottled.