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…

AMD proprietary driver experience

A while ago I bought a new 4k display and my old graphics card could not handle it anymore so I bought a new card, AMD RX 460 with DisplayPort and HDMI outputs that would be ok for the new screen resolution. I bought that card that apparently had decent Linux support.

I did not notice then that in order to get it working I would need to move from 14.04 to 16.04 Ubuntu LTS, but I did the upgrade and it worked but with a software render mode that was quite slow.

Some more googling and I installed the proprietary amdgpu-pro driver, that worked but not ok, among other problems I got:

  1. Numbers on Google spreadsheets won't show when using Chrome (but did with Firefox)
  2. Openscad would crash when rendering a design
  3. Processing programs, any of the examples that uses P3D (OpenGL) would crash.
  4. When my kernel was upgraded from 4.4 I got a failed graphics driver, when trying to upgrade it did not work till I install HWE. And even then I needed to set nomodeset in grub
  5. I experienced random lock-ups, windows noise background and ocassional flicker, mostly when resizing. 
I reported them to AMD and while the second one was fixed with amdgpu-pro 17.30 the othres kept on happening after several upgrades. 

I ran away from Windows long time ago to get a better user experience and this driver brings back bad memories from the past. Definitely not the typical pleasant Linux experience of the last ten years.

So browsing away I learned about the Linux kernel driver support for my card and I removed the driver from AMD

amdgpu-pro-uninstall 

and installed the "open" one:


sudo apt-add-repository ppa:paulo-miguel-dias/mesa
sudo apt update
sudo apt install xserver-xorg-video-amdgpu

Now I am back in business without any of the problems I mentioned above associated with the proprietary driver. I am not sure if all the pain could have been prevented if I never attempted to use the proprietary driver in the first place. I will definitely remember that for future system upgrades.

Update Nov 28th, 2017

After today's system upgrade my graphics are broken again (software render is as slow as to cause real pain). Starting up a 4.4 kernel, at least keeps the graphics acceleration running but I am experiencing a level of disgust that is dangerous for the health of my graphics card.

Oops, why is my /etc/default/grub having a nomodeset in the kernel loading parameters? Getting rid of it get everything working once again.

Comments

Popular posts from this blog

VFD control with Arduino using RS485 link

4xiDraw: Another pen plotter

Software I2C for Arduino