ESP32 Utility driver still not working

I finally got new PCB’s for this utility driver and I still can’t get the programmer port to work automatically. All engineering is like that some times – try and fail – two steps forward, one step back. In this case it sadly involves waiting 6+ weeks for a new PCB once I find ut why it don’t work.

The logic with T1 & T2 should have driven the automation logic. I have double checked and this logic is used by many thought I also see a different solution used.

Well, next step is to use boot and see if I can program the ESP32 at all. After that I need to measure RTS & DTR to see if signals are as expected and basically see if I can tweak it to work.

Plain – Call Instruction

I decided to change the Call Instruction to the one below. As we return with an event code we consume the NIX and process the first “On” that will test for event code and continue to next “On” if not.

At this point I can consider dropping “On” and replace it with “If” or “Switch” – one lesst instruction to worry about. But, I will consider that as all instructions are drafted.

I really like this version of Call as it leaves me with a minimal function call if I don’t need On. Let’s test it out:

Func MyFunc(uint32 x)
    if( x = 1)
         Raise E1("Text 1")
    elseif(x=2)
         Raise E2(2)
    else
         Raise Error(x, "X is wrong value")
    end
Event E1(string s)
Event E2(uint32 i)
Event Error(uint32 i, string text)
End

uint32 x

for x=1 to 3
    Call MyFunc(1)
    On E1(string s)
        println("Event E1 is called")
    On E2(uint32 i)
        println("Event E2 is called")
    On Error(uint32 i, string text)
        println("Error is called")
    End
End

The annotaded figure below show hoe Call would be in this example. I will return to details about On Instructions later.The key with Event’s is that unless it is handled we do nothing, we just fall through. The function will mark Event’s as Optional, Mandatory or Static. If we must have a On we mark it as Mandatory etc.

Plain – Getting the details right

All the Plain entries in here have served their design purpose as I consolidate and wrap up Plain Specification. I usually never bother with a specification on software I do at home, but the complexity and technical design of both language and VM have to many details that needs to be right.

The new VM Instruction header is simplified as shown above.

The old “Object Descriptor” used for parameters have been replaced with a “Data Descriptor”.

The Expression Tables have been moved out from the Instruction and attacched as separate tables at the end of the Instruction Table.

The VM core will be modified, I will return to this later. The main difference is in the Data Descriptor, but also all the details that now get nailed down right so we can move on.

At the end I probably also need to clean up this blog my marking old Plain discussions as obsolete. This happens in engineering as you move forward improving designs.

3D Printer – Prusa i3 MK3 w/MMU

Josef Prusa recently launched 2 3D Printer upgrades that are worth noticing. One is the MK3 and the second is the new MMU Upgrade for the MK3. The total price of these will be something like 900.- EUR. I have copied pictures of them below:

MK3 implement new technologies that are very interesting comparing with what I have on my MK1 clone. The most noteable is the new print plates and the new controller board that uses the TCM2130, a Ramp with SPI allowing current (torque) sensing. This allows the printer to sence end stops.

Multy Material Upgrade with 5 different, or 4 different and dissolvable support material is also very nice.

The most important changes compared to my old printer is however the Marlin firmware and Slice3 slicer upgrades available in open source. That said, I must admit I consider saving up for the MK3 with a MMU. Videos demonstrating this is very convincing.

Brother DCP9015CDW

My first laser printer (a HP) stopper working after years of usage, and I have been in the marked for a color laser for some time. They had a Brother DCP9015CDP on sale, so I went for it.

This is a large All-In-One printer with Wifi. It was dead easy to set up and my wife was happy to see it install on her Mac. The print and colors are ok. I am not sure this is the best printer for photo prints,but I got a big surprice as I printed – it prints on both sides.

Prnter, Copy machine, Scanner and it is soundless except then it prints. The cost in my case was ca 300.- USD so I am happy.

Based on my previous experience I bought the laser some 10 years ago for 100.- USD and have used 3 cartridges costing ca 100.- USD in 10 years. The cost I had in inkjet printers was much higher and the double sided print will cut my paper cost by 50%.

The only thing I actually miss is A3 print for schematics, but I will survive.

Returning to Plain

A blog is excellent for sharing ideas down and returning to evolve them later. It’s been a while since I wrote about Plain. I basically stopped because I had other things I wanted to work on, but I think it is time to review/consolidate the specification and move on.

Is it worth it? Will it make a difference?

I work on PLC alike technology as a profession, and I am stunned by how much work that goes into even simple system changes. What I want to achieve is (1) plug in a new sensor or actuator, (2) automatically detect this as an unallocated resource, (3)  put it into a system diagram with a few clicks.

We will get there…

ESP32 – GPIO 34-39

#4 on the picture above is Servo channels. I discovered that only 8 of there are working as expected. The 4 last ones have GPIO 34-39 that failed in testing – and reading small notes in the datasheet I realize that I have missed out a “input only” note on these pins.

And guess 3 times which pins I used for the single H-Bridge on the little one. I am going to need a special adapter for these so I can program them anyway.

I actually need 12 servos on the Utility Driver, so I will need to grab 4 channels from H-bridges or PWM. I probably need to re-think the Utility Driver(s) a bit.

ESP32 – PlatformIO

I have tried PlatformIO twice. Once for STM32 and now for ESP32. PlatformIO promote itself as open source, but it looks more like a commercial solution with version No 0.14. It can be added to Visual Studio Code. It imports existing Arduino Projects etc.

But, well – two attempts and it is still sorted under “crap that don’t work well” – waste of time and money!

ESP32 with Visual Studio Code & Arduino

Having used Arduino IDE to develope the ESP32 Utility Driver code I must admit that while I in general like Arduino I also miss a proper code editor. Sticking to Arduino (for now) I decided top try out Visual Studio Code.

Visual Studio Code is basically a free and liteweight version of Visual Studio. In this case I just opened the folder and voila. This gives me the option to edit code here and use Arduino IDE to compile and upload.

I am fully aware that more advanced options exist, but I intend to stick to Arduino libs on this project because they are straight forward to use. I actually have the full toolchain & ESP-IDF etc installed. This would probably be my own preferred ways of working, but I need something that every hobbyist can work with – no fuzz – with as little fuzz as possible.

It’s other coder alternatives than Visual Studio Code. Friends of mine stick to Emacs etc. I learned years ago that you don’t mess with developers personal choises unless you want them frustrated and less productive. So whatever works for you is fine.

A note on Arduino 1.8.5 is that it will not detect changes made by a different editor, so changes will be reverted if you save from Arduino after having changed a file from another editor.