ESP32 S3 + DXL MKR Shield Mash-Up in ARDUINO

2/27/2023

Continuing on my mash-up projects with the DXL MKR Shield, here are my current progress on using the ESP32 S3 controller with the Dynamixel2Arduino Library using the wire-wrap experimental carrier developed for my previous ESP32 mash-up project, see post below

ESP32 + DXL Shield MKR Mashup in ARDUINO - #6 by roboteer

I used the UM Feather S3 from Unexpected Maker and the test setup is shown below:

First, using this board with Windows 10 (at least on my current PC) requires me to manually set this board to LOAD mode in order to upload my sketch from the PC to this S3 board using a combination to the BOOT and RESET buttons, and then manually use RESET again to run the uploaded sketch (EVERY SINGLE TIME!). The Arduino IDE wonā€™t be able to flip-flop automatically for the user between the loading and running USB Ports with the current version of ESP32 S3 (for example like for the Portenta H7 Lite).

Second, the usual Arduino Pin labeling ā€œAxā€ scheme no longer applies. For example to use the Pin ā€œA5ā€, now one just specifies ā€œ5ā€.

Thirdly, Serial1 can still be used for the DXL Control Port, but one needs to begin Serial1 separately and before the beginning of the usual Dynamixel2Arduino instance/handle, see picture below:

Next, I checked to see if my Sync Read Write sketch still worked on a Single Core (Core 0 or Core 1, one at a time), and I am glad to report that it worked well with the ESP32 S3 also:

Then, I went on to check the Dual Core version that worked well previously for the ESP32 V2 (see YouTube video ESP32/ESP32-S3 and Dynamixel MKR Shield Mash-Up - YouTube

Unfortunately, at present, I have only partial success:

  1. This Dual Core sketch was compiled and uploaded fine.

  2. But after starting the two Independent Tasks, the S3 just hanged (see picture below):

My guess is that semaphores would have to be implemented next. So stay tuned!

2 Likes

Update 3/3/2023

I am making good progress on several issues (see picture below):

  1. The maker of the UM Feather S3 board told me that the Ax notation for I/O Pins is ā€œoutdatedā€ and GPIO Pin Numbers are preferred nowadays. You can see the pinout of the UM board used here (Introducing the FeatherS3 by Unexpected Maker), Then you can use the IOx numbers to modify the Ax entries in the corresponding file pins_Arduino.h: for example A5 = 5 and A0 = 17 so that you donā€™t have to do much editing to your existing sketches which probably use the Ax notation.

  2. I found that the ā€œtask hangingā€ issue reported earlier for the Dual Core application was simply due to the SIZE of the STACK. I used 2048 or 3072 for my new tests, but I have not tried to pin down the optimal values yet as the UM Feather S3 has plenty of memory for my needs.

The picture below shows typical results displayed on Serial Monitor (physically, the 4 servos were performing as they were supposed to):

  • Looking at the Time Stamp values, you can see that several printouts have the same Time values, this is because the Time Stamp resolution is rather ā€œcoarseā€, about 47 ms. So we had about 12 println per block of 47 ms! That pretty fast multi-tasking for robots, but may be needed for the more expensive DXLs that run at 4-5 Mbps?

  • Occasionally the Serial Monitor got ā€œjumbled upā€, i.e. lost a Next Line character so Output from one Task got mingled with Output from the other Task. So I wonder if the Present Velocity value of 2072 highlighted in yellow was a real Read error or it was just a matter of Serial Monitor being messed up by the ESP32 Task Scheduler? These issues will be need to be looked at more closely later.

In summary, this mash-up project is working out very well, and maybe ROBOTIS would be interested in making a PCB Carrier that only has 3 or 4 Stacking Headers? Two would be used to hold the MKR DXL Shield itself, then at least 1 Stacking Header to hold the header that contains the TX and RX pins of the considered 3.3V Arduino Variant board. That is the minimum to perform the Custom Wire Wrapping needed. This PCB Carrier would be handy for ROBOTIS users who do not have access or skills for soldering, but ā€œeverybodyā€ should be able to do ā€œwire-wrappingā€!

1 Like

UPDATE: 3/9/2023

Just got in today an Adafruit Feather S3 4 MB Flash 2 MB PSRAM. It also got the same issues with needing to use the BOOT & RESET buttons to get into LOAD mode and into RUN mode as the UM board. I am beginning to think that THIS IS a FEATURE of the S3 :face_with_raised_eyebrow:

Donā€™t know when Espressif and/or Arduino are going to fix this issue as according to this Github post, this issue had been discussed since May 2022.

The ESP32 C3 seemed to have similar issues but supposedly the C3ā€™s issue was fixed/closed in Feb 2023 with Update 2.0.7.

May be S3 will be fixed at the next round? Ones can always hope!

Otherwise, the Adafruit Feather S3 board is working well for me.

Also I mounted the Adafruit Feather S3 using only 1 Stacking Header and thus let the other header ā€œfloatā€, but the whole module is sturdy enough so far.

In your article ESP32 S3 + DXL MKR Shield Mash-Up in ARDUINO, I could not find the complete sketch. Do you know where I can copy it from? Thanks.

For which board do you need the sketch for? UM Feather S3 or Adafruit Feather S3?

Adafruit Feather S3. Thanks.

Here it is:

Thanks, I can use that, but I was looking for the complete Arduino sketch so I can understand what is happening before I insert my own code. Is that possible to send?

Your post was deleted. Is your Arduino code unavailable? Is there somewhere I can download the complete Arduino sketch? Let me know. Thanks.

UPDATE 8/9/2023:
Sorry about the delay, but with the recent Arduino ESP32 boards updates (V. 2.0.11) and ROBOTIS Dynamixel2Arduino Library V. 0.7.0, I have found that my previous sketches do not work properly anymore. So I am in the process of rechecking everything now, hardware and software - so far not successful.

UPDATE 8/12/2023:
@crk142
I recently made a thorough review of my previous hardware/software solutions and I have to say that I canā€™t implement them any more for reasons still unknown to me. You can see more details of my findings for the Adafruit ESP32 V2 here:

@crk142
UPDATE 8/16/2023: Arduino Nano ESP32

Today, I received my Arduino Nano ESP32 which is an ESP32 S3.

TEST 1: RC100 via Serial0

On the Nano ESP32, Serial0 is accessible via Pins (RX0, TX1), see picture below whereas I hooked up a BT-210 to Serial0:

RC100_DataFlow_Serial0_0

And I can make Serial0 work fine with TASK2 Output Monitor

RC100_DataFlow_Serial0_2

TEST 2: Position Control Mode with Dynamixel2Arduino Library

For this test, I also used Serial0 Pins and use Pin A6 as TX_ENABLE Pin (White Jumper) as customarily used with Arduino Board such as MKR ZERO:

position_mode_Nano_ESP32_0

And unfortunately, like for the AdaFruit ESP32 S3 and UM ESP32 S3 boards, I could not make this sketch to work also:

position_mode_Nano_ESP32_1

Sketch compiled and downloaded fine, but at run time cannot control the actual Dynamixel although the sketch executed fine.

position_mode_Nano_ESP32_2

Greetings, have you managed to have another look into this? I am trying to do the same thing with a Teensy 4.1 and Iā€™m not having much success.

Unfortunately I have not figured out any work around. I am getting the same problem with the new Arduino UNO R4 also.

Thatā€™s quite frustrating. Iā€™ve had a go at quite a few different things without success :confused: I have ordered an Arduino MKR board to continue the testing but from all I can see - thereā€™s no reason it shouldnā€™t just workā€¦

I also tried downgrading the library to an older version - didnā€™t seem to make any difference.

Okā€¦ So I had a bit of a quick hack just now and managed to get it working. I connected the 5v pin on the DXL MKR Shield to the VIN (5v) of the teensy4.1 and it worked.

I also deleted the line where I begin the serial1 port and the code worked the same as with - I donā€™t think itā€™s needed.
Serial1.begin(TTL_BAUD);

I have only tested the LED on and off function so far but I hope this helps you too.

Ping and scan now working. Iā€™ll stop posting and do some control tests and come back when I have more to add :slight_smile:

Wonderful news! I guess that having the same ground was not enough. But the system needed the 5V node synchronized too! Looking forward to hear more progress from you!

1 Like

Hey Roboteer - All of the features Iā€™ve tried work; position and velocity control work great. All at 1mbit I havenā€™t tried going any higher than 1mbit as I read somewhere that the DXL MKR shield doesnā€™t go higher. The latency is good enough that I havenā€™t tested it :slight_smile:

Iā€™m building a robotic spider called Bobbie (build log here). Iā€™ve got a heap of coding to get through before heā€™s walking but Iā€™ll try to remember to post back here when heā€™s ready.

1 Like

@spidey, Glad that you got your Teensy working, but your suggestion did not work for my Nano ESP32, so still back to Square 0 for me!