Moving code from ESP8266 to ESP32

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…

Windows 10: Upgrade if you can

Since 2000 I am on a Windows-free diet. But that does not mean that I am totally ignoring Windows,
after all, it is what most people use. So I have a few computers still running XP, Windows 7 and Windows 8.1. Last week a couple of my laptops offer me the chance to upgrade to Windows 10.

A few weeks a friend bought himself a nice Bang & Olufsen laptop equipped with Windows 10. My friend is a long-time Windows sufferer and he seemed to be quite happy with the latest Windows version. So I decided to bite and try the upgrade by myself.

My first system was two years old Toshiba laptop with an i5 and 8 GB of RAM. I started the upgrade and everything went smoothly though terribly slow, the whole process taking perhaps ten hours (not sure exactly how long as I went to bed, bored of waiting. And I do not think download speed is to blame here as I have fast Internet connection at home (apparently a bit more than 2 GBytes are downloaded).

My second system was an older, low performance AMD-based HP laptop with 3GB of RAM. The process started smoothly but after one day I could only see a rotating sign below the Windows icon on the screen while zero hard-disk activity was happening.  Tired of waiting after more than 24h I powered cycle the laptop: on booting up the system crashed and I thought I totally screw it up, but on the second reboot the upgrade was able to continue. But apparently only to keep on doing the same. I left it to its own devices for three more days with no apparent change. So I decided to power-cycle it again. At this point I was really lamenting to have attempted the upgrade and I was thinking I might need to reinstall the system. However, I was pleasantly surprised to see a message on the screen saying that Windows was reverting to the previous Windows version. And twenty minutes later the system was brought back to life from the death.  I, for one, have to congratulate Microsoft people decided to put forward this escape route.

I have not explored Windows 10 deep enough to have an informed opinion but so far I am glad the start menu is back.


Popular posts from this blog

VFD control with Arduino using RS485 link

4xiDraw: Another pen plotter

Software I2C for Arduino