pocketbeagle 2 and embedded systems teaching

Hi,

I am new to embedded systems, with very little bare metal programming (standard hobby projects such as driving a 2x16 char display with i2c using a STM32 Nucleo board, security camera using esp32 with lot of help from AI). I am a CS lecturer. I got a crazy idea to propose an embedded linux course using packetbeagle 2. Is it worth it? Should I use the book exploring beaglebone by Derek Molloy? Is there a better option? I need to get expertise on embedded systems (I have > 40 yrs of sw dev experience), I have lot of time on my hand. I have some SBCs with me. Thanks in advance.

I like the idea very much - as the beagle-family is a great target for this kind of course - i think!

did you just try what the pocketbeagle-2 does out of the box?
(for me there are in the mail now ;-))

the first and most important questions for such an idea are:

  • what is your target audience
  • what are your learning-goals
  • what is the background information your audience brings with them

if the idea is to do something more classical / theoretically maybe something in this direction:

  • in the stock linux system
    • very high-level python / node-js / bash - play-around with some leds and an button / webpage
    • how to automatically start such an application on system-startup
    • play with LED-PWM / I2C or SPI sensors / Pixel-LEDs / RS485 / DMX or similar more hardware related things
    • maybe use the RPU for some fast counting actions? (as fare as i have read that is in no way trivial to understand/learn)
  • maybe have a look at Status Zephyr support for PocketBeagle 2?
    that would go into the direction bare-metal (without an real OS)

personally i like it more to do real projects that have a HW part to have something real / moving on the table…
all with there own sort of problems you could run into and therefore learn the best ways how to design a system / where the edge cases and so on are..

  • classic light-barrier / watch-stop (something relative fast crosses two light barriers - the program has to stop the time from the first to the second and try to calculate the speed..
    • could invole into an (very basic) coin detection thing (more light barriers.. doing very accurate / reproducibly time/order patterns…
  • small balancing robot (PID / similar)
  • there are so much more ideas…
    and they are not new. the art here is to do the course-design in a way that really makes you want to participate in / have fun doing it..

maybe this is some kind of inspiration - maybe i have misunderstood your request completly :wink:

sunny greetings
stefan

Hi Stefan,

I appreciate the reply.

The target audience is undergraduate students, most of whom I expect to have some C programming knowledge and Linux basics. Another prof colleague mentioned that he would be interested in joining me if I can propose the course so that we could teach. This is the context.

I want to

  • teach building a minimal linux image from source code and load it in a board. I have built Linux images and brought them up using qemu. I created simple ramfs and also used busybox.
  • i want to add a heavy hw component (my knowledge in this area is sketchy)
    • I would like to add i2c, spi, pwm. I don’t know what else is there. I have done some bare metal code to drive a 2x16 char display, I am in the process of driving the wheels of an RC car using pwm. If I am successful, I will add that. I have done a security camera in esp32 and if I can do that in pocketbeagle 2, I will be adding that too.
    • I would like to add some signal processing (my Ph.D. topic) to hw. I am not sure if I will be able to do that in the course time. Basically shazam like stuff.

Now, you know what I am trying to do in a 15 week course.

1 Like

I think you should sign up for https://zulip.openbeagle.org/ and get in touch
with either Jason Kridner or Kathy Giori.

It would be a shame if you somehow missed each other…

Thank you very much. I will contact them.

I’ve programmed quite a few embedded machines, msp430 and arm m type cpus. What to me is fundamental there is they are bare metal, and don’t have MMU on the chip. This means you can’t really implement a high level operating system like linux (sideline there was uClinux for MMU less chips) - and related here is these DSPs are typically low memory and flash (say 16kB memory and 256kB flash), there isn’t really the space for much of an OS.

This means that to me, DSP programming and you need to read the TRM in detail, and how to bring up the board. E.g. typically need to configure which clock source is used, and where pins have multiple uses - program them to what you need. This is really low level programming, and pushes to understand that most peripherals have memory mapped registers. The peripherals are universal in both DSP and CPU designs, e.g. a pwm need dedicated silicon, and always live outside the core of the DSP/CPU although on the same silicon; or clocks which may or may not be on the same chips.

So the big change for me is in the TRM, the chip designs documentation on the chip. For small DSP designs - this can me hundreds or thousand of pages. e,g, a series x5xxx msp430 TRM is 1190 pages. When you move onto the PB2 CPU there the am62x TRM is 16613 pages. A 1000 page TRM you can get on top of, when you understand how its organised. The am62x TRM you can start on when you know the architecture of the chip - but it rapidly gets involved. E.g. although we have vaguely programmed the PWM on an am62x (see thread elsewhere on this site)- we haven’t yet got top of everything. What seems to be the problem is the PWM memory mapped registers are controlled by the MMU. Now this means programming the am62x is tricky - very tricky, and to my mind would be hard to get on top off in a course. Just booting is tricky.

So I’d vote with simple DSPs, so the msp430 or arm m type chips, with excellent TRMs (e.g. Texas Instruments). There bring the chip up, is doable and not too involved.

Have you though of arduino devices - that is bare metal with an easier interface. Its not a direction I’ve been in.

1 Like

Hi,

Thanks for the reply. Since my university has already a good curriculum in embedded systems, my selling point, at least I think it is, is to have a course specifically for embedded linux. That’s why I am staying away from non-mmu boards. The reason I selected pocketbeagle2 (and raspberry pi zero) is the attractive cost factor and a good support like this forum. I would like to keep the cost low so that I can (try to) convince the department to buy these boards and allow the students to borrow for the duration of the course. BTW I am just preparing all these to go and propose to the department. There is no guarantee that it will be approved, but I will be ready with all these plus I am sincerely working on doing everything (bought a board, loaded linux, working on some simple projects) because of my own interest in gaining experience in embedded systems. After reading your detailed post I got another idea for an embedded signal processing course which I am planning to talk to my old advisor who is still teaching in the same university.

i am full on with David,
the atmega328 (orig. Arduino UNO) is a datasheet i was able to read and - after some time - understand.. with some more reading i got over the arduino build in things and started to configer my timers myself..
on a so complex processor i do not think that this a good idea for a curso. (in just my opinion)
maybe a ESP32 (that is already much more complex then the 328 and i did not full read or tried to understand it :rofl: )

maybe i just did not understand exactly whats your goal - why do you want to go bare-metal?
and i think there is a ready-made build-pipeline - if you just want to build a already well supported and tested debian or so with some small tweaks - i think this could work..
(have done this for Aria G25 - Linux embedded system on module module..)

so the selling point is embedded linux - so the linux part is the key?

i have no idea what others think of what is the crucial part of embedded linux -
maybe have a read / question in the https://embeddedrelated.com/ pages.
i think there are some nice and interested people there too…

for me its the combination of linux with the hw-things like spi / near-realtime things.. (just like the examples i give in my first post..

just out of my own interest:
is the 15 weeks fulltime? → 15w5d8h = 600h? very unlikely :wink:
how much hours do you have per week or in the full course?

i hope you find a good way for your interest to translate in a nice course format! :slight_smile:

And just reflected on post so far - to get an idea of what the course is aimed at.

So embedded linux, but bare metal.

So is the course about how to create a linux that would boot - e.g. Linux From Scratch style. if so then course would be something like:

  • Building a cross compiler
  • Building a kernel for the beagle
  • Booting on the beagle, so uboot - and anything else that needed for security based systems
  • initramfs construction, busybox + some other things like simple scrips to get things running
  • Then how to link the initramfs into the kernel
  • Writing everything to an sd card
  • Plug into a beagle, switch it on - and watch and led flashing

So is this the kind of thing planned, already looks quite involved - and there are many subtitles along the way - so you would really need to know what you are doing.

Think as much as anything its understanding what “bare metal linux” means … there is a lot of background in each of those words - so need to understand what the aim of the course is for, what skills are you attempting to pass onto the students?

I was reading here and found that the TM4C123 has a good starter from years back that I followed to handle each and every possible facet of the on board M4. It is an older model. 16 years ago, I am pretty sure, is the last update to the programming model and so on in the TRM.

Outside of that one M4 and I understand you are building around specific processors here, newer M4 processors exist along with an updated TRM for specifics. Then, there is the CMSIS which has recently, a year or two ago, been broken down in to many subsets.

If you can manage baremetal on a power horse of a processor like the am6254, more power to you.

Anyway, the reason I brought up the older model M4 processor on the TM4C123 is because of the fact that UT did a TI.com introduction course for the launchpad that holds this specific M4.

I was highly interested in it. From stepper robots to UART debugging, there must have been three books and tons of interest from UT in the M4 tech then as it did go.

Like the plus pages in the TRM for the am6254, there is an IPC and M4 with such powers from Linux and/or the am6254. It is really quite interesting. Transferring data from and to a M4 from such a power processor via IPC is quite powerful.

Anyway, some may help or shy you away. I say if you have a known university backing and are willing to try, go for it but Linux is a powerful entity too. I would not shy away from it so far. You can handle groups and the backing of such groups with lacking full knowledge or give specific people use cases of “full” knowledge of working conditions.

For instance, Tom knows about Lisa’s and Miguel’s working Linux Distro but Sam can only see Lisa’s typing and build requirements. systemd stuff…

Sometimes it is more clear in the future picture why things are the way they are now and this goes along with Linux and the building blocks surrounding Linux, processing, and giants in the game.

systemd is a power horse like the processor in question. I am literally shaming the input from others on this forum at times because of how much they know compared to me. I try to not do so with the current status of my life. But!

I make mistakes. I think the baremetal Linux realm has been vanquished. I am not 100% positive but what I have learned is that intrinsics need overseers and managers. The overseeing is not so much collective as it is needed. Anyway…

Seth

P.S. Good luck on your endeavors! It is not easy to handle embedded as is now and baremetal embedded is the deprecation while the baremetal Linux is the vanquishment. I am pretty sure here…

Update

did anyone contact beagleboard.org personnel yet?

Hi,

Yes. Embedded “Linux” is the key. There are two selfish reasons - I am very much interested in the topic and I need a course to teach so that I will get paid.

Since I am so low in the totem poll, I am not even sure if the higher ups will listen, but I am going to make it so attractive (I think it will be) to the students that it will have some traction. I am getting a lot of good suggestions and ideas in this exchange. TY.

I am greedy and hence included “bare metal” into the mix. I got a big thrill when I did bare metal programming for the first time which I thought the students also would experience.

Thanks for the comments. The loading of linux in the board is only the first part of the course. In my grand theme of things, one half of the class will use pocketbeagle2, the other half will use Raspberry Pi Zero (both will provided for the duration of the course). The second part of the course will contain how to program hardware components using the GPIOs - such as driving a 2x16 LCD module, blinking on board LEDs but changing the frequency of blinking using the on-board user button presses, and also to drive a motor using PWMs. If time permits for a grand finale, use PWMs to drive the wheels of an RC car.

The course will be a 15 week course - each week meeting twice for 2 hours each. There will be a lab of 2 hours each week. This is the plan.

1 Like

That is neat but I think you should discuss it with the beagleboard.org personnel first.

Seriously, they put that SBC together and may promote other boards in the future. And just for the listeners and readers, I am not affiliated with the beagleboard.org personnel. I would like to try to keep them around for future times when, and yes selfishelsy I must admit, I keep trying to get out of mowing grass.

I am basically like the person from M.A.S.H, old sitcom, that did his darndest to get ejected, ridiculed out, and expelled from the Army but I am just a grass mower. In the position with BeagleBone Boards and SBCs at the forefront, I am slowly learning skills to promote findings and to stay ready for when, if ever, I will be needed.

Anyway, good luck with the courses and teachings. If you learn the IPC jargon, come on back and proclaim.

I am always willing to learn more and dedicate time to beaglebone boards and SBCs.

Sounds good, so quite a bit of emphasis on the peripherals inside each chip. So programming gpio, uart, Pwm, i2c timers and alarms. Doing this on SBC, can be done and beagleboard make it as easy as possible with the software they provide, for doing gpio, and then the various kernel methods of the kernel etc. Now the downside of this, is the generic solution is by its nature generic. E.g. The Pwm control in the kernel covers just about every Pwm hardware, and that means it’s fairly simple. E.g. Else where on this forum where we looked at driving a stepper motor using pwm, problem there is need phasing between pwm channels, and the kernel interface can’t do that. So a raw write to the memory mapped Pwm registers was needed. That code has consequences, e.g. Has to be run as root, and there were bits of the ordering of commands we never got right (so some pwm modes, like enabling the pwm, we never managed to do). When you look at doing the same with microcontrolers, the Pwm hardware is the same typically, but writing to the registers is easier than via a high level os. Looking at uart, then the kernel interface is far easier as the kernel does the necessary buffering, and feeding the uart character via the uart interupt. On a dsp, you have to do all of the processing yourself, and it’s tricky to cover all things, so the interface typically has limitations. So I’d say think carefully which perhiperals you want to drive, and how easy it is in an OS, vs writing the raw registers in a dsp.

Thanks for the insight. Now it confirms how much I don’t know about embedded systems. I will program (try to) the peripherals and I will include those that I can, to the list of mini projects. Once the course is approved, adding other microcontrollers may be easier.