UART communication in ESP-12E - esp8266

I am using micro python in same board to start a serial communication
from machine import UART
uart = UART(1, 9600)
uart.init(9600, bits=8, parity=None, stop=1)
uart.write('abc')
and reading serial data using usb to serial converter which i plugged on pin 21 and 22. But that is not printing anything i checked with the help of termite.
and also uart.write('abc') prints 3 in python REPL.
Please point out my mistake.is it possible to read serial data using serial converter or not?
PS:I have read many forums but not found anything useful.
TIA

Unfortunately, I've never used esp-12E yet but referring to its document here I can see that UART1 has only TX, unlike UART0 (which has both TX and RX).
After some search, I found out that RX of UART1 is used to connect the flash chip, that's why UART1 is TX only, unlike UART0.
So editing your code to
UART(0,9600)
Should fix the error, hopefully.

Related

Requirements for initiating a print on a 3D printer via USB

I thought it would be fun to implement a rudimentary version of Octoprint that can receive a gcode file and initiate a print on my Prusa i3.
What are the requirements for initiating a print on a 3D printer via USB?
You can use the pySerial library in Python to send raw G-Code to the /dev/ttyWhereverYourPrinterIs serial device. Most printers specify their baud rate in their UI, or user's manual. My printer says its USB baud rate is 115200.
Quoting Gina Häußge:
If you are only targeting a very specific printer with a very specific firmware variant: serial connection and then read up on https://reprap.org/wiki/G-code. It becomes a horrible nightmare to implement and maintain though when you take the thousands of firmware variants out there into account, so beware.

Wireshark does not capture dpdk interface packets

I am trying to capture the data packets from dpdk interface.
Using pdump+testpmd, able to capture the data packets.
However, if Wireshark is used with testpmd, the above fails.
Any suggestions highly appreciated. Thanks
Working on Ubuntu v 18+, DPDK v 19+ Wireshark v 3+
The solution is to use the pdump application. As others mentioned, once your DPDK application takes ownership of the network card, the kernel will not see the packets, and tcpdump hooks will not be triggered.
The documentation explains how to i) compile dpdk with support for pdump and pcap ii) enable your primary process - your application - to give packet information to a secondary process - the pdump sample application.
You can then use the generated pcap with wireshark.
As soon as you bind the physical interface from kernel to a DPDK driver (igb_uio, uio_pci_generic, vfio-pci) it becomes removed from kernel netdev for both Physical Function and Virtual Function. These NIC ports are accessible via UIO driver, and application like DPDK which has the PMD can probe and init the devices (with some exceptions).
If you want to use the port with Wireshark, unfortunately you have to bind it back to the kernel. You can also just capture packets to a .pcap file using DPDK and analyse it with Wireshark offline - if that fits your needs.
[EDIT-1] There are 2 ways to capture packets on UIO DPDK bind
make use of rte_pdump_init API in the primary (desired) DPDK application and use DPDK example dpdk-pdump to capture packets for RX or TX for desired queues.
Unbind the device from UIO and bind it back to kernel driver for netdev interface. start the DPDK rte_eal_init with special argument --vdev=net_pcap0,iface=[kernel nic interface instance]
Note: In option 2, one can run Wireshark and capture the packets too. But will lose out on performance and DPDK specific functionality.

ESP8266 AT+CWLAP gives generic ERROR message with no details

I have been having trouble all day learning how to enable "AT" commands for the ESP8266 module. I'm using my Arduino Uno as a bridge to my ESP8266. So my pin connections are:
ESP8266 | Arduino
-----------------------
TX | TX
RX | RX
CH_PD | 3.3V (separate battery that has common ground with arduino)
VCC | 3.3V (separate battery that has common ground with arduino)
GND | GND
GPIO0 | GND
I initially had some success with an ESP8266 Flasher that someone shared here and he provides instructions here. Essentially I use an esp8266_flasher.exe to load a ESP8266_BIN0.92.bin into my ESP module. This worked so far as in when I load up my Arduino IDE Serial Monitor, I can type the command AT and get OK response, and I can type AT+GMR and get the firmware version number. But typing AT+CWLAP after any of AT+CWMODE=1,2,3,etc.. gave a generic ERROR response, with no other details.
Has anyone else had this issue and know how to resolve it?
EDIT
I also tried a second way to resolve my AT command issues as described here: ESP8266 No response in serial monitor from official AT firmware
I know this thread ist super old but I dealt with the same question.
That AT+CWLAP returns an error without any prior connection is desired behaviour. The doc states that AT+CWLAP "[c]onnect[s] an ESP station to a targeted AP with [the] last Wi-Fi configuration." Since there is no last Wi-Fi configuration an error is returned.
Moreover if you have characters like ,, " or \ in your SSID and/or password you do have to escape them (see here). The documentation has an example.
AT+CWMODE=1 is the correct mode if you want your esp to be a client only.

How to connect TX and RX on the ESP8266 to USB pins D- and D+ on the NXP LPC1769?

I have a board (with NXP LPC1769) hosting an application and connected to the PC via USB cable. I use an application running on my PC and communication is pretty straightforward (some ASCII commands are exchanging) and working as it should be.
So, what I would like to achieve is to connect my favorite WIFI module ESP8266 using its TX/RX pins to the USB connector (D- and D+) of the NXP LPC1769 instead of my PC.
You may ask why you don't use any UART pins of the LPC1769. And my answer, I would love to. But it requires pretty much code modification which is not pleasant at this stage for me.
Pins P0.29 and P0.30 used from LPC1769 connected to USB connector.
Here is the existing schematic;
I would like to ask if this is even possible, and if possible, what are the options?
(I am inexperienced with NXP MCUs, still a work in progress, please bear with me).
Thank you.
NO my friend, it is simply not possible to connect USB serial to Rx/Tx pins of the ESP8266. First there is the hardware limitation, only asynchronous serial communication is possible with the ESP8266. That device has no USB host in it that can be programmed so there no way to do what you ask simply with that circuit. Nevertheless i would suggest implementing a simply board with a FTDI device of your choice (FT232R for example) and do the conversion from USB to asynchronous serial communication (Rx/Tx) directly.

Need help using Arduino R3 as serial-to-usb converter (to program something)

I have researched (and learnt quite a bit), but I have little experience in programming and only really understand basic sketches so far. I would like to use the Arduino R3 (more specifically, the usb to serial converter chip) to program a full-size hobby radio.
I have connected my radio to the Arduino appropriately (5V, Rx, Tx, Gnd) and put the Arduino into Tristate mode (apparently you have to do this..), but I seem to be lacking appropriate drivers. I basically want my Arduino R3 to function exactly like this: CP2102 . Please note that I am not being super cheap. To get something like that where I live would take at the very least a month. Some people also say that I should remove the Atmega chip. The ultimate goal is that I have a device, with drivers, on a com port and not just an "unknown device".
So, my questions are: leave the Atmega on, or remove it? and which drivers do I need?
Thanks!
EDIT: I found almost exactly what I need just after I posted. For some reason I couldn't get it to work, but maybe you could help me understand? Here's the link LINK If anyone is keen to help me out!
Just to make it clear: it has been done before, but I get the feeling people leave out things which they think are obvious, but to the not-yet-professional tinkerer like me aren't :/
Thanks so much!
It seems like the links you reference are for older Arduinos with an FTDI chip. The Arduino Uno doesn't use that. Here's a link for using the Uno
So! All of the older Arduinos (NG, Diecimila and Duemilanove) have
used an FTDI chip (the FT232RL) to convert the TTL serial from the
Arduino chip (Atmel ATmega). This allows for printable debugging,
connecting to software like PureData/Max, Processing, Python, etc.
etc. It also allows updating the firmware via the serial bootloader.
The good news about the FT232RL has royalty-free drivers and pretty
much just works. The bad news is that it can -only- act as a
USB/Serial port. It can't act like a keyboard, mouse, disk drive, MIDI
device, etc.
and
The Arduino Uno has a number of facilities for communicating with a
computer, another Arduino, or other microcontrollers. The ATmega328
provides UART TTL (5V) serial communication, which is available on
digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board channels
this serial communication over USB and appears as a virtual com port
to software on the computer. The '16U2 firmware uses the standard USB
COM drivers, and no external driver is needed. However, on Windows, a
.inf file is required. The Arduino software includes a serial monitor
which allows simple textual data to be sent to and from the Arduino
board. The RX and TX LEDs on the board will flash when data is being
transmitted via the USB-to-serial chip and USB connection to the
computer (but not for serial communication on pins 0 and 1).
Basically the LINK you provided, shows the user HACKING the Arduino. Using the USB/Serial(TTL) converter(what ever chip that is on your Arduino) to link to the Radio's Mini Din connector, in place of connecting to the Arduino's CPU.
As stated in other answer the Arduino uses a CHIP (of some flavor) to bridge the USB(Virtual Serial Port) to the Serial Port of the ATmega328 micro. These pins are available on the Shields connector 0(RX) and 1(TX). Hence you see the picture wiring those pins to the Radio's DIN connector.
Where I would expect in addition the RESET of the Arduino's CPU would be held to GND, this would force the pins into Hi. Simply with an extra wire jump the RESET pin to a GND.
It's working! Somewhere along the line the drivers for my arduino seem to have been deleted, so I reinstalled them, did what you said, and learnt something.
So to clarify for others: pretty much plug and play (as the link I posted suggests), but make sure to install the arduino drivers properly.
Thanks a lot for the help!

Resources