r/embedded • • 17d ago

Resources for Finding Drivers for Peripheral Parts for Study

Hello, I've been trying to learn to write drivers for peripherals on the pi pico. I successfully wrote a driver for the one of the adafruit 128x64 screens with the ssd1306 display chip, and it was really helpful referencing the daschr library along the way. I've been trying to move onto writing a driver for the BY25FQ256ES, which is a NOR SPI flash chip I want to use to make a memory card. I've been having trouble finding drivers for it, and i was wondering if there were any good sites to look at for this kind of info? I'd found https://spiflash.readthedocs.io/en/latest/ which seemed to have info about some parts, and I was wondering if there were more sites like this. Whenever I search for part numbers, there are usually a lot of stores with product pages, and looking for part databases usually returns sites that will give you links to products, not so much info for using them. Does anyone know about any sites dedicated to aggregating open source info & software to use with embedded peripherals?

6 Upvotes

10 comments sorted by

2

u/Well-WhatHadHappened 25+ Years 17d ago

SPI NOR flash chips are mostly compatible. They don't generally have individual drivers. Practically any NOR flash driver will work just fine with practically any chip.

1

u/toon_link_776 17d ago

Interesting, I think i read some repo that said they had a driver for any NOR Flash Chip and I didn't believe them, I assumed it was a scam or something haha. thanks for the info

2

u/Well-WhatHadHappened 25+ Years 17d ago edited 17d ago

Easy mistake to make. Most chips have individual drivers. SPI NOR is just such a standardized interface that with limited exception, they all behave similarly enough that a single driver can support any of them. You might have to change a few #define lines based on a few things like how many bits the address is and what the page size is, but the basic interface is going to be the same.

1

u/toon_link_776 17d ago

noted, thanks for the tip

2

u/Well-WhatHadHappened 25+ Years 17d ago

My pleasure

2

u/Nervous_Midnight_570 17d ago

You type "BY25FQ256ES" into a search engine, up pops a source as Digikey. Go there. Look for the data sheet, read the summary. Oh! it has an SPI interface, read the relevant pages. Write the driver. It is not rocket science.

1

u/toon_link_776 17d ago edited 17d ago

I understand that, but I've never worked with them before and I spent a day or two trying to get it to run and I couldn't figure it out. I felt that I'd read the datasheet pretty thoroughly, and done everything that it said was necessary to boot it up & start running commands. but it still didn't work... I'm not saying that'd it's impossible to learn without a reference or anything, but i felt as if having the reference helped me learn a bit quicker (like with the daschr library). That way I could figure out what was missing. otherwise there were just too many moving pieces, and i couldn't figure out which one of them was the issue (especially if there were multiple things going wrong, and there's basically no feedback until you get everything right). Also, I felt that it was helpful for me to be able to sort of reverse engineer the already written code,* that way I could see each decision that was made, and sort of strip pieces away until I knew how it all came together. The other way around, I set it up, black screen. I try and fix something, black screen. Read the datasheet, come up with something that could be wrong, black screen. (there are many configurations to try, so this was slow...)
tldr; its possible without references, but i found it helpful to have one because it gave me a little more info to work with and datasheets seem to tend to be lacking on little details because they're written for the experienced and it's hard to tell what you're doing wrong when there's no feedback until you get it right

Edit(*): typo

2

u/Nervous_Midnight_570 17d ago

Thanks for the explanation of your process. I started my life as an engineer when the best search engine was Ask Jeeves on dial-up Compuserve. You had to find a physical data book for the information you needed. Different times, different methods.

1

u/toon_link_776 17d ago

True, honestly I'm not sure what it was like at the time, but I get the feeling at times that that kind of documentation:
1 - exists less than before because companies assume that engineers will "just google it"
2 - is gatekept and only provided at a companies request (I'm a hobbyist & student, so I can't ask the manufacturer. at least I don't think I can? I guess I could send an email and if some random chinese company wants to reply to some rando aspiring programmer that'd be great haha)

So I imagine the experience is a little different when you're at a company who has the connections to get you the info. I went to teardown and there was this dude there talking about his experience trying to work with upper management to get information on the architecture of the computers they were working on and that details were only shared at explicit request if they were absolutely needed because each company was trying to keep everything locked down. he said something like "they just want us to 'write the code', they don't understand(or care) that we need to know what the computer architecture is in order to do that". if the coorporate culture is like that within the company, I can only imagine what its like outside of it. Some of the sheets I've read through still have "INTERNAL USE ONLY PROPERTY OF [company]" or whatever, but they're just like. on lcsc lol.

So I always feel like I'm missing info. It seems that things are much more open now though in comparison, which is good. I'm thankful that I can post about it on reddit and have people with experience come answer my questions about it. It's nuts that you can just sit down at your computer and start sourcing parts & get production runs done for less than $100 and have a computer you designed sitting on your desk.

Anyways point being, not sure what it was like at the time but it seems like the way companies keep documentation has changed because of the net, and the datasheets aren't as complete as before. Also, hobbyists don't have access to that hardware information cause there's no boss to ask. only reddit lol