Posts

Showing posts from October, 2013

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…

Teaching Rambo how to print

Image
I could not resist the temptation and I bought a discounted RAMBo board a while ago. Today each
attempt to upload some code ended up in a list of messages like the ones below:

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

First idea was that the board might not contain a bootloader, but after using my recently acquired ICSP programmer and obtaining a dump of the ATMega 2560 from the board I could see it was exactly the same as the one from a regular Arduino Mega board. 

As it is a new board, there is a chance of being a DOA. But I was surprised that no LED was lit when I connected the USB port. However, I could see one of the LEDs from the serial port (I guessed this is what they were) blinking when I was trying (unsuccessfully) to upload a sketch to the board.

I realize that while I dumped the flash memory of the Mega, more LEDs were lit. It then hit me that maybe the only problem was that the board (the version I am usin…

My printer port is gone!

Image
After the last change of computer I was asked for help to installed the bootloader on an ATMega 1284P processor for controlling a 3D printer. I have been using for years the Arduino Parallel Port Programmer with great success (it worked every time if I remembered to power the board through USB at the same time).

But it turns out my new desktop computer does no longer has a parallel port. Not a big deal as all my printing happens through the network, but it was a no go for any type of other fancy uses of the parallel port (no, I do not have a CNC machine controlled with EMC2, though I have EMC2 software installed in my computer).

So I finally gave in and ordered a USBASP programmer that was less than 5€ off eBay and fixes the need for a tool for uploading bootloaders to new boards. It comes with a 10 to 6pin adapter too, which was needed for Arduino boards ISP connection.

You can use it from the command line with avrdude program or from Arduino environment selecting USBASP as the type o…