Showing posts from September, 2011

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…

A bit more RSA

I really don't like when I do not understand anyone's code, so it takes me a bit of effort till I do my own homework to create my own version of things I can understand. Being a teacher, I always find troubling not to be able to explain things to my students, so I used some time to create my very own RSA implementation. I've found a very good reference text here.

My perl program takes three parameters data, encryption (or decryption) exponent and module and it returns the encrypted (or decrypted) version. As it uses BigInt library it should be happy dealing with any of your big numbers. You can find a Java implementation in the above mentioned text too.

#!/usr/bin/perl use Math::BigInt; if($#ARGV<2) {print "Usage: exp, module\n"; exit 2;} $a = Math::BigInt->new($ARGV[0]); $b = Math::BigInt->new($ARGV[1]); $c = Math::BigInt->new($ARGV[2]); print "out=".($dec = $a->bmodpow($b,$c))."\n"; Contrary to what may look, bmodpow ha…

Playing with RSA

A recent assignment required me to dust off my knowledge of RSA (public-key encryption algorithm). While it is something I do teach every year, I usually do not have to fiddle with the code. So when I was needing a pair of keys (public+private) for some test I needed to look around for some  key-generation code.

Once I've got my pair of keys I was surprised with this implementation of RSA encryption in perl:
#!/bin/perl -sp0777i However, the fastest way to get you working is using OpenSSL's genrsa command.

Remote Desktop is gone

Last year I bought a small notebook to keep me updated of what was available in Windows 7. Being a small computer, using it for a long session and, in particular the mouse pad, is not very pleasant. So while I am not on the go, I rather would prefer to access this computer remotely to use my desktop's bigger screen and more comfortable mouse.

I was shocked when I learned that Microsoft had "streamlined" some versions of Windows 7 so some features were missing for some of them. I later learned that Windows 7 Home Premium does not include the Remote Desktop server that was common in Windows XP.

I occasionally use remote control tools like TeamViewer with great success (or other variants of VNC) but the main problem is they do not work as smoothly as Remote Desktop Protocol (RDP) nor they allow you to resize the desktop area at log-on time.

One colleague of mine mentioned, while I was complaining about the missing Remote Desktop on my notebook, that there was a hack to get…