I didnβt think Iβd need to say this, but apparently I do:
Donβt use the Raspberry Pi 2040 to build a DCC decoder.
Itβs not really wrong, of course, and it gives you ridiculous amounts of computing power, but to get that you need miles and miles of extra components. Like a dozen of decoupling capacitors, an external oscillator, and of course an external flash memory. You can maybe do that sort of thing in H0, but for real model trains, itβs just not ideal. Pick something like an ATTiny or STM32C0 (Iβve done both for different projects): Cheap, just one or two decoupling capacitors, no external oscillator required and no external flash memory needed either.
The versions of the RP2350 with built in memory may be a better idea, once they fix the GPIO issues anyway, but still, thereβs the oscillator and just way too many capacitors.
(Some of these concerns may be different if you want to add sound support, which requires more memory anyway. But Iβd argue that sound in model railroads is a mistake anyway. Iβve never seen an N scale locomotive that sounds good, itβs all just an annoying expensive gimmick.)
Also while weβre at it, donβt use a cheap standard bridge rectifier. The steep slopes of the DCC signal mandate a really fast rectifier, typically Schottky diodes. This is particularly important when you have RailCom on your layout. You may need four individual diodes instead of one rectifier, but since you wonβt need all the capacitors of the RP2040, you still win out in the end (itβs also typically smaller than the rather large SMD standard rectifiers).
This is a call-out post for https://github.com/gab-k/RP2040-Decoder . Itβs a useful project, but itβs also far from ideal.