Posts

Showing posts from April, 2009

Moving code from ESP8266 to ESP32

Image
A while ago I made a mashup of Dan Royer's code CNC 2 Axis Demo with my own code for trapezoidal motion stepper and servo control for ESP8266.

I assumed porting the code to the ESP32 would be trivial, and that was true for the most part: changes like library name being Wifi.h instead of Wifi8266.h were not a problem. UDP now does not like multicharacter writes but you can use print instead. So far so good.

However, when it came to the interrupt code I was stuck with the stepper interrupt causing an exception sometimes. And to make things weirder, the servo interrupt worked flawlessly (both of them had the IRAM_ATTR directive if you ask me).

Going little by little, I could narrow down the culprit to a floating point operation during the interrupt, that would cause problems sometimes but not always. Browsing around I found this post. Where the solution was simple: do not use floats within the interrupt routines but doubles. The reason was the float calculation would be performed by…

Buildroot: What for?

Image
Programming when your target system is not based on x86 architecture and you use a PC for development can be done using a cross-compiler. There is a GNU cross-compiler for many different platforms.

What if you'd like to test the code without using the target system. There are good news too, as you can use qemu emulator to get a system with a non-x86 architecture emulated on your x86 system.

But you might want to get a development system running on your same target hardware. This is interesting if you have a way of accessing the target computer filesystem. It can also be interesting if you want to be able to fine tune the set of versions and libraries to be used by your development system. Here is when buildroot comes in handy.

Buildroot allows you to create a development environment for your embedded system around uClibc (which is a scaled-down version of glibc used for many Linux-based embedded systems). With this tool you select the architecture, kernel, compilers and libraries ver…

Remote control your computer

Image
Some people are keen on the idea of using cellphones as a remote control. After all they are usually around, have a small size, a nice display and even some of them have an illuminated keyboard.

Among the choices for interfacing with another equipment, Bluetooth seems to best choice: more standard than infrared and lower power requirements than wifi (besides not many phones have IR or wifi).

Around this concept of using your Bluetooth cellphone as a remote was created AnyRemote project. I've tried lately for a home project and I'm very happy with this suite. Yes, it is actually a more complex system than I expected: You cellphone needs a special program to act as a remote, this program in written in Java and you need to download it to your phone. Then server software is installed in your computer and a set of configuration scripts tell your computer what to do when each key is pressed. On the other hand, user menu is provided on cellphone display (there is even a midnight comman…

Ambient Light Sensor problem

Hardly more than 90 days old, our MacBook 2.4 was already featured here as it has already caused me some trouble. Not a good thing I have to talk about it again: Yesterday it stated to make fan noise when idle, and the display backlight was changing for no apparent reason. After several unsuccessful attempts, I've found this article about resetting SMC as somewhere else I was suggested it might help.

Unfortunately though the SMC reset did help with the fan noise it left my system with no ambient light sensor. Whether it was related or not I do not know, but now I cannot use F5/F6 to change the keyboard backlit which remains off. I get a forbidden sign as if the ambient light was very high so as not to require any keyboard backlit. Unfortunately this seems not to be the case in my dark room and it still refuses to allow me to switch the backlit on.

The next exercise on the list was to perform a PRAM reset, that did not fix anything either. And, according to Apple support, the next st…