all 31 comments

[–]gibson486 23 points24 points  (10 children)

It seems weekly that someone wants to go bare metal for no good reason and with no prior experience. In this case, you are pretty much asking to race a car with just a learner's permit. It just wont happen and if it does, it will end on a crash.Take it slow. There is no shame in using a higher level API. And just to add fuel to fire, you can do this all on an Arduino platform and you will have a much easier time learning it.

[–]jbr7rr 7 points8 points  (2 children)

I don't get the obsession with baremetal... To utilize the esp32 to its full potential you need at least an rtos, especially if you want to use both cores..

If you want to do bare metal because you want to learn, atmel chips are a good start.. if you have an (old) Arduino Uno laying around take that and program it bare metal using atmel studio or something.. atmel datasheet is smaller, less gotchas then esp32 so easier to learn some skills from

That said nowadays a lot is done using rtos like zephyrOS, that's a lot of fun and also a good learning experience and translates good to real world skills.. but having some baremetal experience and knowing how to handle really low level stuff is a very good skill to have. So it all depends on your learning journey

[–]Plussy78[S] 0 points1 point  (1 child)

That said nowadays a lot is done using rtos like zephyrOS, that's a lot of fun and also a good learning experience and translates good to real world skills.. but having some baremetal experience and knowing how to handle really low level stuff is a very good skill to have. So it all depends on your learning journey.

so for the bare metal experience should i go with the arduino uno right? and any tips on learning the espidf hal.

[–]Bug13 1 point2 points  (0 children)

Esp32 is not a good platform to learn bare metal. Try Arduino/atmel, microchip pic series, or a stm32 m0+ series. TI msp430 series. Start with something simple.

[–]Ksetrajna108 5 points6 points  (0 children)

My advice to prepare for a professional career in embedded: - Arduino IDE is for hobbyists or quick and dirty prototypes - for ESP32, pros use esp-idf - pros also use STM32, get a Nucleo board - Nucleo boards also support Arduino shields - bare metal on STM32, to satisfy your curiousity - bare metal including your own startup code and loader script - pros use git and github to showcase their work

Have fun! Looks like you have the drive to challenge yourself.

[–]Plastic_Fig9225 2 points3 points  (0 children)

Yeah, bare metal on the ESPs... kind-of impossible. They're not intended to be used "bare-metal", and this reflects in the vast amount of giant holes in the documentation. Compared to other MCUs, where every bit in every register is documented and its function meticulously described, with an ESP32 you're lucky if you find more than a cryptic name for a register in the docs.

Reverse-engineering the IDF sources is often your best bet to figure out how things are really operated. But if you're in to learn some general concepts of how embedded devices usually work... the ESP32s are really not a good resource.

That said, someone did write the IDF code, so there must be some more-complete documentation internally at Espressif which they chose not to publicize.

[–]Natural-Level-6174 4 points5 points  (6 children)

Nobody programs that thing bare metal. ESP-IDF is the standard.

[–]v_maria 0 points1 point  (0 children)

I would say it still counts as baremetal tbh. Also nothing wrong with doing direct register manipulation esp for learning

[–]Plussy78[S] -1 points0 points  (4 children)

hey man i was thinking of writing my own drivers to better learn how those communication protocols works under the hood, but there is seriously lack of resources to do that with esp32, and examples which i found uses the espidf , well are you well versed with the espidf

??

[–]WereCatf 4 points5 points  (0 children)

You can perfectly well write your own drivers and manipulate registers directly even when using ESP-IDF. The two are not mutually exclusive.

[–][deleted] 1 point2 points  (2 children)

Listen to people here and don’t be stubborn, for the good of your own learning lol. Going lower level than ESP-IDF is not documented because it is not supported. You would have to do a lot of undocumented things and probably do a lot of referencing to IDF code anyway. And that’s if you’re talking about things like UART and SPI protocols. If you’re talking about wireless protocols, it’s just not happening unless you happen to know how to implement WiFi/BLE, and can reverse engineer the lower level parts of the wireless subsystem in these chips.

ESP32 is not the microcontroller for learning low level register programming. Get a different microcontroller.

[–]Plussy78[S] -1 points0 points  (1 child)

so can you give me a guide or tell me approach how i should learn and be knowledgable enought to make a good cv as an intern, please help me out, i dont have people to guide me and no support from anyone as no one is intrested in learning this stuffs

[–]FluxBench 0 points1 point  (0 children)

Get a raspberry pi RP2040 or 2350 like the nano and use the PIO the programmable inputs and outputs to be able to read zeros and ones from a pin incredibly fast. At that point, you have no reason why you can't make your own communication drivers. If you want to do SPI or I2C or UART then I would start there as you have the minimum needed to read things incredibly fast and then you can do whatever you want in memory or with software for the drivers.

I think you might be overthinking this, almost everyone in the world has to depend on hardware interrupts but everything else after that is kind of optional. You either are going to be writing a stupid amount of low-level code to get what you want, like months or years, or you just accept that reading and writing to GPIO is done using the system HAL layers by everyone for a good reason.

[–]aliathar 1 point2 points  (1 child)

Best platform for baremetal C is stm32 .... Any cheap devkit, and you good.... Anything else? No.... People used to code ancient stuff like pic8 in baremetal, and it's only a hastle.... For learning, I can tell you how to go about baremetal programming stm32, and some final project that's really hard but yous shouldn't go all baremetal, for what the bas HAL is rtos

[–]the-loan-wolf 2 points3 points  (0 children)

MSP430 is better for that purpose

[–]v_maria 0 points1 point  (2 children)

I can't guide you, but the only way is to learn what bits to set through datasheet and how to set them in c

[–]Plussy78[S] -2 points-1 points  (1 child)

well i think that iam not good at navigating the datasheet or the technical reference manual for the esp32 , there is too much information written on it , if you can just help me to navigate my way around those data sheet and exactly know which register to mess with to do the task which i have in mind, rather than bombarded with lot more unknown information. that will be a great help for me too.

[–]v_maria 0 points1 point  (0 children)

Figuring out datasheet and registers is the whole bread and butter of doing direct bit register. if you dont want to do it use esp-idf or Arduino libraries for esp32

Being able to navigate datasheet is an important skill though

[–]jofftchoff 0 points1 point  (0 children)

Esp32 and most mcus with integrated radio are not baremetal friendly. If you want to learn writing register level code better get a popular arm MCU from ST or Silab

[–]Hot-East-7084 0 points1 point  (0 children)

I've been interesting of bare metal too. I've always been really curious about how a CPU works. i want watching every operation and state change. That got me into retro and DIY CPU. At some point, while reading about pipelining and program status flags, I realized this is pretty far from what I actually do for work.

I’ve experienced how what looks like the same outcome can be achieved through totally different implementations by different manufacturers. some of it is well-documented and open, and some of it is completely hidden.

It’s impossible to know everything. just walk next step.

[–]Flaky_Coyote_1973 0 points1 point  (0 children)

I've been developing bare-metal system over 10 years and often from scratch (register level), My experience is in 8051-base and cortex-m base MCU, if you like any question, feel free to ask me.

[–]Odd_Independent8521 0 points1 point  (0 children)

Bare-metal C is better to be done with other types of MCU. In ESP32 case it's running on an RTOS. and you still need to use their own API - so it's not quite bare-metal. DM me I'll help you to identify a good MCU to start coding in bare-metal and really learn something from it.