TL;DR I got the debug output from Signet's UART
- The reference manual is well organized!
- I added lots of comments to the code to reference which section of which document that it came from
- I got confused with calculating the UART BR register value for a desired baud rate, but that doesn't really matter because...
- The UART port "just worked" with `screen` on Fedora 38. I'm not sure if I transposed something in the command on my Debian 12 box or if they have different defaults for parity/stop bit, or something else is going on. I'm busy the next few days, but I'll boot that box again to investigate further in a few days
- The reason my previous test was constantly writing to the `screen` was because the debug output is continuous as there are apparently some debug print in the main loop
Overall, this is excellent news. Not only did I get the ability to see runtime debug print statements from the firmware, but I also got familiar with how to find low level information about this MCU.
Plus with the notes I made in the code, next time I'm going through it (or someone else is), it'll be easier to trarck these things down.
I found that reference manual. It's 29.5 MB and 1600 pages. I sure hope it is well organized so I can find the one little thing I am looking for in there.
Oh, nevermind, this is in 0x40000000, but I'm in 0x48000000. I'm not going to try to grok this until I really need to!
I feel like if I asked a chat bot to "give me a complicated looking diagram" this is the kind of thing it might spit out...
Did you mount dev to a really weird path? Or is that sysfs?
I'm used to looking at /dev/cpuinfo for this sort of data (or running lscpu on fancy, new distros).
What's it like programming an MCU? Well, this is the section of the programming manual I'm reading right now:
#m=image%2Fjpeg&dim=701x692&blurhash=%7C5Rysf4-%7Eqj%5Bxuxu%25Mxu%25MWT9F-%3Bj%5Dt7xuWBxuWB00M%7Bxbfk%25MofRjt7ayRjWCM%7Bayj%5BRij%5BWAj%5Bog%25MIUV%5BayM%7Bs%3AWAof%3FbogWBt7M%7BRjWBRiWBxvf8Rjt7WBWBj%5BWBof%25MWCIUayt7j%5BaxWBof4nRjoft7ofWBt7R%25of&x=a17e707768c2509b383d18c1f030e2dccccb5c3192a947e147503234dcd8a7bb
While I was looking for a "reference manual" for the STM32L442KC, I came across an option to buy the MCU directly from the manufacturer. I pay about $8/chip (about $9 after shipping). If I bought direct, $2.67/chip! The catch? I have to order 10,000 of them at once!
So, I'd need to be operating at an enormous scale for that purchase to make sense. $26,700 is a lot of money.
If I were operating at that scale, I could also buy all the other components at a better price per unit, but the main costs are
1. Software and hardware R&D
2. Hardware assembly
3. Parts
In that order, and there's a huge gap in between each one. Still, $5 less in parts, plus getting them direct from the manufacture is still pretty attractive.
Someone defaced this trash can at a busy food hall. Who would do such a thing just to spread a policitcal message?
#m=image%2Fjpeg&dim=1440x1920&alt=A+large+%22vote+for+better+money%22+sticker+is+on+a+trashcan+on+Broadway.&blurhash=_jI%3BXk%7EQj%5DkDWWWDa%7DIWRkt2obococj%3FE3R%3AR.WCa%24WFj%5BShj%3FoIoeayjsayIvRkj%3FWFoJoJf7RkWXkCoIa%7DWXj%5BV%5BR.azj%3Dj%5Bocj%3FbbWVWCa%24aza%7Da%23bbWBf7azo0oJjs&x=77263c696322fbafc04e14698ae6a85f68fccceb537ee452545d5fc9a4684c02
Looks like hackaday is going to help me out. https://hackaday.com/2020/12/23/bare-metal-stm32-exploring-memory-mapped-i-o-and-linker-scripts/
Maya Posch, if you are on Nostr, I want to follow you and give you a zap for writing this article!!!
It looks like I might be at the end of the line.
The MCU datasheet specifies the memory mapping for the PORT A range, but not any information on the structures that go there.
There's not even a reference to some other document that defines those structs.
I see references in the comments to AF7 and the code isnsetting af_num to 7, which seems to match. This lines up with pins 19/20 being UART1.
Ohhhh, PA9 and PA10, not literally pins 9 and 10! I think it's starting to come together. Can you feel the excitement?
But why does the comment say USART2 init if it is really initializing UART1? Is it a comment that is wrong? A typo? Maybe they used to use UART2 and then switched to UART1 and just missed updating the comment?
The variable is named usart1, so it feels like a deceptive comment, but what does the code say? Will I be able to confirm it before it's time for the 2600 meeting? We'll see...
Send sats to nostr:npub15u3cqhx6vuj3rywg0ph5mfv009lxja6cyvqn2jagaydukq6zmjwqex05rq to support that site.
No. Also, nostr.cooking isn't mine, I'm just the one who reported the issue.
I've now confirmed that I have the correct baud on the receiving side (115200).
But there's a comment that says "pin 9-10" and that is NOT where my pins are going.
I started digging into the datasheet for the microcontroller to see what's up and pins 8 and 9 can be configured as UART2 (19-20, the ones I am actually connected to, are UART1). But at best pin 10 is USART2_CK.
The hunt continues
You should grow your own turmeric. It's fun and TheSameCat agrees, just look 👇
Took a few days to get nostr.cooking accessible from Tor, but it also took almost that long for the turmeric to dry. Here it is, a recipe to grow, harvest, and process your own turmeric!
#homestead #homesteading #garden #gardening #GrowNostr
They're both still there. So at least I know they didn't get immediately taken down by management.
I have been recommending https://nostrtool.com for the conversion. Will look at options to build into the site
That worked. I was able to gey my nsec, log in, update a recipe and publish it. So I know I am really logged in as the same user.
Thanks for giving some devops time to privacy advocates like me. You're making the internet a nicer place, one step at a time. ❤️
And there's a memory write that goes to a field in that struct that is only ever written and nothing ever reads it.
I'm guessing this is some CPU magic that just knows that when a value is written to that address, it should transmit it over the UART_TX pin.
So now I just have to find the places which interact with this magic struct and somewhere it should show me what the options are for things like baud rate, parity and so forth. Hopefully that will let me determine where I've got something misconfigured.
I'm getting output on the UART pins when I plug in the FT232R, but it's [almost] all gibberish.
Can confirm that as long as I get Cloudflare's permission, I can get to zap.cooking now (over Tor).
Unfortunately, I have some seed words that I'd like to log in with, but the site only accepts nsec, which I do not have and can't find a tool to generate it for me on a mobile phone.
#m=image%2Fjpeg&dim=1920x1440&alt=A+%22Vote+for+better+money%22+sticker+graces+the+cart+return+at+a+local+grocery+store.&blurhash=%23vH.NfaeM%7Baza%23j%5DWVjZf6_4oJWBayWCWVkCayfPxvj%5DfRoff6j%3Fayj%5BaybIogjZayoeaxjZa%7Ca%23M_WCj%5DayaefPfjjtfQRjj%5BofjsazbHayf6j%3Ft7aeWBayoMayfRazj%40&x=2a39c4c6a02c8420f66344fb539c0d31a81440d0122b04e430fa9dea095a0cb6
#m=image%2Fjpeg&dim=1001x193&alt=A+terminal+showing+some+source+code+that+includes+setting+some+pointers+to+structured+to+hardcoded+memory+addresses.&blurhash=H041z%5D%7D_%253NEogxcxb%3D%24S0I--Y%24-bGNEj%40o3S0R%25&x=a9422bdc02d1c239de96dbbb97373475875c51d11bef07638cd9812dd44818b6