4 ms·
I'm very newbie to microcontrollers and I bought 10 pico boards, 5 with pins, 5 bare. What I've found not very nice is that there's no official programmer for R
by vbezhenar 5y ago
I'm very newbie to microcontrollers and I bought 10 pico boards, 5 with pins, 5 bare. What I've found not very nice is that there's no official programmer for RP2040. I can use one board, upload firmware and connect it to the other board with wires, actually that's what I'm doing right now with breadboard, but that's not very nice to use, I have lots of wires laying around.
I'm thinking about creating a programmer with 3D printer and some spring contacts, but I really would love some tiny device with RP2040 inside where I can put another RP2040 and have all pins available for further connecting if necessary. Right now it's a mess of wires.
Another RP2040 aspect which I didn't like is a complexity of boot process. Now I have no idea whether it's common to microprocessors or not. What I wanted to do is to write my software with pure assembly without any SDKs. So far my research is as follows:
RP2040 contains unmodifiable boot1 code. You can't modify it at all. It contains some preliminary initialization code and some procedures like float point operations, etc. That looks very weird to me: why put that code in unmodifiable ROM. There're few revisions of this ROM with different procedures (I guess they optimize them in later revisions).
Boot1 connects to flash and loads 256 bytes of boot2 loader which contains 252 bytes of code and CRC32.
Boot2 is compiled from SDK. It configures flash for some kind of faster access mode and calls sdk initializtion procedures. I didn't investigate further yet.
I managed to learn ARM Cortex M0 assembly, at least most of it, and it's interesting to try to program with it. But now I'm stuck with reading about flash, those QSPI protocols and their commands to make sense of their boot2 bootloader (I could just re-use one from SDK but I don't like this way). And then I still need to understand how to configure the whole stack to run code from flash.
Basically to re-implement writing hello world to UART, I have to learn a lot of things. Which is fine, I guess, but I didn't imagine this being that hard. I thought that I would need to learn about UART hardware and how to interact with it and that's about it.
And I really don't like their SDK. I managed to get it up and running, but they're using cmake which is cryptic for me, it takes seconds to compile my software, I have enough of that in my Java work. I guess that's fine for professionals who need to get things done.
That's not to say that I don't like this project, I still think that's the most friendly ARM, at least when I tried to use STM32 it was much worse. RP2040 datasheets are very readable for beginner. I just wish their setup was not so convoluted.
At this stage I'm considering to drop flash usage at all. I have 256 KB of RAM anyway, ought to be enough for anybody, right? Just copy my program from flash to RAM and run it from RAM. On the plus side is predictable performance. I still don't understand how can one write timing-sensitive code with flash where jump to non-cached address could stall CPU for some unspecified number of tacts.
- danhor 5y agoThe programming interface and the bootloader in rom setup is more-or-less standard in the ARM microcontroller world. For programming the RP2040 you can use any SWD debugging probes (which you can also use to debug the chip, single stepping, setting breakpoints and more). Many like the Segger J-Link (the EDU Mini might be an option), while I prefer to use daplink based probes, of which there many available. The RP2040 is especially egregious with it's RAM caching, but many ARM Cortex chips, especially the faster ones, utilize some sort of caching, since internal flash might not be fast enough. Often dedicated peripherals are used (the PIOs for the RP2040) and/or critical routines are copied into RAM (but usually not everything).
- TillE 5y ago> I can use one board, upload firmware and connect it to the other board with wires Yes, the picoprobe is the official programmer/debugger. It's super cheap, easy to set up, and I'm not sure why you'd want anything else.
- Goz3rr 5y agoThe boot process you describe is a side effect of using external flash. Microcontrollers with internal flash like the STM32 will just start executing at a certain memory address depending on which boot mode is selected. I'm curious what you think made the STM32 worse however, as in my experience they have good documentation and good options for the development software (and also a few not so good ones)
- mmoskal 5y agoI particularly "like" the how they copy&paste manual sections for TIM1, TIM3/4, TIM6/7, TIM14, TIM15/16/17 (this is from STM32G0). I get it, there are some features only available on say TIM1, but why on earth would just copy everything, instead of having one TIMx section and saying "only available on TIM1-4" on specific registers? It's particularly fun if you want to write a driver for all TIMx - you have to de-dup in your head. I find the LL (low level) library from STM relatively nice; OTOH their (high-level) HAL is plain awful. Simply writing registers isn't too bad either, especially that even in that case what you write will mostly work across their different microcontrollers. In general, I find the NRF52 docs and hardware to be much more straightforward but it could be that they don't have to support every single feature on the planet like STM ;) edit: typos, wording