4 ms·
I started learning C at the start of this year by going through K&R and Understanding and Using C Pointers. I will likely pick this is up, it looks good and I r
by maxioatic 7y ago
I started learning C at the start of this year by going through K&R and Understanding and Using C Pointers. I will likely pick this is up, it looks good and I really like No Starch Press books.
Does anyone have pointers on where to start with actual embedded programming? I have a couple Arduinos and RPis laying around, but I'm wondering if there are more 'real' ways to do it.
- huanwin 7y agoMuch of my job is embedded engineering, to establish a bit of credulity for the following recommendations. My employer is partial to ST Micro and Renesas, so keep that in mind. Others may suggest Silicon Labs, Microchip, or Texas Instruments. This will also be biased by my own education and work experience (e.g. no robotics, more sensors/lights stuff). I'd recommend getting a dev kit like the STM32F4DISCOVERY (https://www.st.com/en/evaluation-tools/stm32f4discovery.html https://www.st.com/en/evaluation-tools/stm32f4discovery.html). ST Micro's boards are often used for courses (https://www.udemy.com/course/cortex-m/ https://www.udemy.com/course/cortex-m/) so you may like to take some of those courses. You'll often hear about the TI MSP430 as another microcontroller but AFAIK it's beginning to be a bit dated. Although come to think of it, there's probably more educational material out there for it, if you're willing to search. Grab a kit like the Sparkfun Beginner's Kit (https://www.sparkfun.com/products/13973 https://www.sparkfun.com/products/13973) and read some of the tutorials on their website about creating circuits. Tutorials or courses for your dev kit should get you to a point where you can light an LED controlled by the micro. From there, you may like to do more advanced stuff like communicating with sensors over specific protocols (Sparkfun's Tinker Kit and associated guides may be of use https://www.sparkfun.com/products/14556 https://www.sparkfun.com/products/14556 though you will have to translate from Arduino to C code, which can be good practice for knowing how Arduino works under-the-hood). At this point, you'll probably know whether you want to keep learning more about sensors/lights/IoT type stuff, or want to branch out to other embedded-related topics. More advanced IoT material will be things like taking sensor measurements, storing measurements to memory, interfacing with displays, sending data via WiFi or Bluetooth. Edit: I skimmed over a lot to keep it short. There's a lot hiding behind how casually these recommendations are made, so feel free to reach out with any questions (email in profile).
- nprescott 7y agoIf you are looking for a full course this one isn't bad: Embedded Systems Shape the World[0] it does hew pretty close to platform specifics (Windows/Keil/TI Launchpad) which can be good for specifics and not good for holistic understanding. I have had a lot of fun following Ben Eater's[1] projects, which aren't always embedded-specific (sometimes they're TTL, sometimes Arduino) but are excellent for understanding concepts deeply. I tend to learn best with a specific project that can grow or morph as my interest or experience dictates. You might find something to build with an Arduino, using the toolchain/IDE/libraries, get it working and then start stripping out libraries for your own implementations, or getting a toolchain of your own to cross-compile and flash. [0]: http://www.edx.org/course/embedded-systems-shape-the-world-microcontroller-i http://www.edx.org/course/embedded-systems-shape-the-world-m... [1]: https://eater.net/ https://eater.net/
- maxioatic 7y agoThanks for the recommendations! That's how I like to learn as well, and kind of why I started learning C in the first place. Tinkering with electronics is super fun (I think). I actually have built the clock module from Ben Eater with the intent of building the 6502 computer project at some point in the future. I really like his stuff.
- wuschel 7y agoFrom a C-veteran perspective, what do you think about type safe (e.g. dependent types such in ATS, or F*/KreMLin, or other DSLs) languages that compile to C, or a subset of C? How could one get the safety promises that are observed in Rust in C? Thanks!
- ajxs 7y agoI'm not the OP you're asking, I'll provide my own answer to the latter question though. C is a language that doesn't come with many guarantees. I personally like to think of C as a 'higher-level assembler', targeting a virtual machine. I've been led to believe that this figurative description of the language was more common in the past than it is today. I find it a helpful description since it offers an explanation for many of C's design choices. Such as it's weak types and use of pointers. If I'm correct it's also an accurate description of the language's original aims in system development. Also, Rust isn't the only systems programming language with a focus on safety. Ada has been around for some time now and is a much more mature language and arguably more suited for the job. It has a demonstrable track record of successful use in safety-critical software. Rust is definitely more 'C-like' than Ada, which might make it preferable to many.
- rramadass 7y agoI can recommend the following for Embedded Programming; * Michael Pont's Embedded C and Patterns for Time-Triggered Embedded Systems (PTTES). They are chock full of invaluable C code (for 8051); in particular, beg, borrow or steal PTTES (free pdf available). Also checkout his other books and his company SafeTTy Systems. * Make: AVR programming by Elliot Williams teaches you to directly program the ATmega328P on a Arduino Uno. * Introduction to Embedded Systems: Using Microcontrollers and the MSP430 by Jimenez, Palomera et al. is an excellent textbook explaining each hardware aspect of an embedded system and how to program them. Note: All the above are for bare-metal embedded programming. For Embedded Linux on RPi, i suggest Exploring Raspberry Pi: Interfacing to the Real World with Embedded Linux by Derek Molloy.
- CJ_Ting 7y agoCheck out this awesome course cs107e (http://cs107e.github.io/ http://cs107e.github.io/) from Standford. It will guide you to build a complete os from scratch in Raspberry Pi.
- retSava 7y agoA good and motivational project imo can be to buy a simple sensor board for the Arduino, and write a driver yourself for it (even if drivers exist). Pick a simple sensor - some will require you to do all kinds of hoops and loops, but others are more like "startup, trigger sensor read, read out". For this part, it's also fun to have a logic analyzer (starts at about 10 bucks) to see the change in code manifest on physical pins. It's also helpful to see that what you think you are doing, is actually happening. Eg, the SPI Chip select pin may be inverted (high when should be low and vice versa). Then start off with a simple program that does init, and periodically read the sensor. Perhaps adding thresholds that trigger eg a LED. Then you can extend this to pipe over serial port to the rpi and push it to some server of your choice (eq mqtt), or display on a local webserver dashboard. Go with sensors that are ordinary SPI or I2C, not some one-wire-protocol. Suggestions, BMP180 (temp, RHum), TSL2561 (light). Have fun! edit: if you are doing it on the Arduino, you can start off with the arduino spi/i2c libs, and later on if you wish, fire up the AVR datasheet (or whatever cpu is on your arduino) and implement i2c/spi yourself by changing registers etc on the cpu.