Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: ESP32 Support ?

  1. ESP32 Support ?

    Hi there, trying to port over some robots to the esp32 platform but cant seem to find any libraries for it yet.

    Anyone know of either a) ideas for how to do it b) an actual library for the esp32 that can control dynamixel servos?

  2. #2

    Re: ESP32 Support ?

    Most of the libraries for the Dynamixels are split in two parts; one is for "talking to the serial port to make it do the RS-485 single duplex thing," and one is for "formatting Dynamixel-format byte buffers for packets."
    Generally, the serial port bit is very small and isolated to a few functions. You should be able to take any existing dynamixel library, take out the serial port functions, and re-implement them for whatever the ESP32 wants as a replacement.

  3. Re: ESP32 Support ?

    Quote Originally Posted by jwatte View Post
    Most of the libraries for the Dynamixels are split in two parts; one is for "talking to the serial port to make it do the RS-485 single duplex thing," and one is for "formatting Dynamixel-format byte buffers for packets."
    Generally, the serial port bit is very small and isolated to a few functions. You should be able to take any existing dynamixel library, take out the serial port functions, and re-implement them for whatever the ESP32 wants as a replacement.
    would you be willing to accept some kind of contribution to develop this? i am not a good programmer and havent been able to find anyone willing to do this.

  4. #4

    Re: ESP32 Support ?

    Thanks for the offer, but my dance card is already over-full :-(

  5. #5
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,227
    Images
    27
    Rep Power
    270

    Re: ESP32 Support ?

    KurtE has modified version of the Arboix dynamixel library that should work with Arduino "Serial", "Serial1", "Serial2, "Serial3", "Serial4", and "Serial5" objects. It is known to work with the Arbotix-m and most/all Teensy-3.x boards (has special cases to use the direction pin functionality built into Teensy serial objects), so will likely work with the ESP32 without any modifications.
    https://github.com/KurtE/BioloidSerial

    Kurt can confirm, but I think the usage would be along the lines of ax12Init(1000000, (Stream*) &Serial1, PIN_DXL_DIR) and BioloidControllerEx(1000000, (Stream*) &Serial1, PIN_DXL_DIR).
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

  6. #6

    Re: ESP32 Support ?

    Actually I am not sure, how this will work with ESP32... Likewise I am not sure how you wish to hook it up.

    With the Teensy 3.x boards, it works two different ways:

    1) Without any need for external hardware: That is you can configure the USART to be in half duplex mode (TX PIN), and there is a way to then tell the USART if the TX pin is to be used for TX or RX... So there is code in the library to set the appropriate registers at Initialization time to be in half duplex, and likewise code in place that when you send data it turns it into TX mode and when the data has been fully output switch it to RX mode... I have not seen any documentation on the ESP32 saying that it supports Half duplex mode. Maybe it does. If there is some document or the like on it... Would not be hard.

    2) Using a direction pin to switch from TX/RX mode. This is typically used to support RS485 output chips, but on the Teensy, I have also used this to control buffer chips, which also switch the 3.3v output of the Teensy to 5V. With the Teensy there is support in the USART to handle the direction pin when you output something to the serial port and when the serial port code detects that the usart TX buffer is empty and has fully shifted it's data out... Again not sure about ESP32. This part would be easy to hack in a version that should work. That is when the library is ready to do output, it would set the direction pin to WRITE, then do the outputs... Then wait for the writes to complete like Serial1.flush(), then set the direction pin to READ... I believe the library will currently do this when it does not know the actual hardware (i.e. not Teensy). But again this would require external hardware.

  7. Re: ESP32 Support ?

    KurtEck , ever thought of trying to port your code to the esp32 , see if its possible? I know the esp32 has enough uarts , i just dont know how to get it talking half duplex

    Quote Originally Posted by KurtEck View Post
    Actually I am not sure, how this will work with ESP32... Likewise I am not sure how you wish to hook it up.

    With the Teensy 3.x boards, it works two different ways:

    1) Without any need for external hardware: That is you can configure the USART to be in half duplex mode (TX PIN), and there is a way to then tell the USART if the TX pin is to be used for TX or RX... So there is code in the library to set the appropriate registers at Initialization time to be in half duplex, and likewise code in place that when you send data it turns it into TX mode and when the data has been fully output switch it to RX mode... I have not seen any documentation on the ESP32 saying that it supports Half duplex mode. Maybe it does. If there is some document or the like on it... Would not be hard.

    2) Using a direction pin to switch from TX/RX mode. This is typically used to support RS485 output chips, but on the Teensy, I have also used this to control buffer chips, which also switch the 3.3v output of the Teensy to 5V. With the Teensy there is support in the USART to handle the direction pin when you output something to the serial port and when the serial port code detects that the usart TX buffer is empty and has fully shifted it's data out... Again not sure about ESP32. This part would be easy to hack in a version that should work. That is when the library is ready to do output, it would set the direction pin to WRITE, then do the outputs... Then wait for the writes to complete like Serial1.flush(), then set the direction pin to READ... I believe the library will currently do this when it does not know the actual hardware (i.e. not Teensy). But again this would require external hardware.

  8. #8

    Re: ESP32 Support ?

    Quote Originally Posted by planaria View Post
    KurtEck , ever thought of trying to port your code to the esp32 , see if its possible? I know the esp32 has enough uarts , i just dont know how to get it talking half duplex
    Not really, like others I have enough projects to keep me busy.

    As for not knowing how to get the Usart into half-duplex mode, neither do I...
    If you look at their documents, like: https://www.espressif.com/sites/defa..._manual_en.pdf
    And look at section 13.1:
    ...The Universal Asynchronous Receiver/Transmitter (UART) is one such standard that canrealize a flexible full-duplex data exchange among different devices. The three UART controllers available on a
    chip are compatible with UART-enabled devices from various manufacturers. The UART can also carry out an
    IrDA (Infrared Data Exchange), or function as an RS-485 modem.
    So it looks like it mainly supports half-duplex. It does have some mention of RS-485, but if you do a search on ESP32 RS-485, you will see several places where it mentions there are some registers, that mention 485, but not much else...

    If some one actually found a way to do half duplex or the like, I would be happy to take a Pull Request and maybe even try it out. I do have one or two ESP32 boards sitting around here somewhere...

  9. #9
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,227
    Images
    27
    Rep Power
    270

    Re: ESP32 Support ?

    It is pointless to ask whether it actually supports a half-duplex mode on single pin like the Teensy-3.2 because none of the ESP32 pins are 5V-tolerant so it can never be used directly with the TTL dynamixel buss. And RS-485, CAN, LVDS, etc. transceivers always require a full-duplex UART connection even if the buss they connect to is only half-duplex.



    To connect the ESP32 to dynamixels, you will need some buffer ICs to handle the logic level conversion which will also handle the 3.3V full-duplex ESP32 UART to 5V half-duplex dynamixel buss conversion. Select the ESP32 Arduino Serial object of your choice and a Digital pin to toggle direction by controlling the output_enable pins of the buffer ICs (TX when high / RX when low). On my ESP8266 boards, I used 74_1_126 (TX pin->buss when OE high) and 74_1_125 (buss->RX pin when !OE low) buffer ICs in SOT-353 package which is quite small and difficult to correctly assemble when not using a well made stencil. The 74_1_126 would be powered by a 5V supply with the ESP32 TX pin connected to the input (A) pin and the dynamixel buss connected to the output (Y) pin. The 74_1_125 would be powered by the ESP32 VIO supply (likely 3.3V) with the ESP32 RX pin connected to the output (Y) pin and the dynamixel buss connected to the input (A) pin. The direction pin of the ESP32 would be connected to the OE/!OE pin of both the buffer ICs.


    Edit:
    Ooops. Used the wrong buffer IC names. The 74LVC1G125 and 74LVC1G126 that I first posted were the original buffer ICs that I used, but they are not guaranteed to be able to translate up from 3.3V to 5.0V because the lower threshold at 5V for Input High is 3.5V. While they usually work OK, I switched to the SN74LV1T125 and SN74LV1T126 buffers that are guaranteed to work in translating 3.3V to 5V (actually guaranteed to work with input voltages down to 2.03V with a 5V supply).
    Last edited by tician; 5 Days Ago at 11:41 PM.
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

  10. #10

    Re: ESP32 Support ?

    I agree with Tician! You probably would need to add hardware to do this, which I mentioned earlier 2) in a few posts ago about probably software support already there, may take a tweek...

    Note: I have also done it with one chip SN74LS241 - I used the surface mount version, but they also have a through hole version. It is an octal buffer, where there are two groups of 4, with one group having positive gate and the other negative gate...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Which ROS release for dynamixel support?
    By memmerich in forum ROS - Robot Operating System
    Replies: 2
    Last Post: 02-20-2017, 05:53 PM
  2. Support for Arduino 1.6.0?
    By KurtEck in forum Arbotix, Microcontrollers, Arduino
    Replies: 16
    Last Post: 12-24-2016, 05:47 AM
  3. Arbotix Pro ROS support
    By calmur in forum ROS - Robot Operating System
    Replies: 20
    Last Post: 10-31-2016, 01:35 PM
  4. What is this Horizontal Support Thingy?
    By Fanatic in forum Robotics General Discussion
    Replies: 3
    Last Post: 08-23-2012, 08:21 AM
  5. software support
    By chocobot in forum Humanoids, Walkers & Crawlers
    Replies: 8
    Last Post: 04-03-2007, 01:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •