Debugging for esp8266 through jtag? - esp8266

I am working on esp8266 - NodeMcu.
According to the docs from EspressIf, I couldn't find any documentation about Jtag port in Esp8266, so I think Jtag port is not supported in this chip.
However, we can debug esp8266 with Openocd via Jtag port. Here is the forum discussion for this:
https://www.esp8266.com/viewtopic.php?f=9&t=1871
Accordingly, Esp8266 needs to connect to Jlink debugger through pins GPIO12, GPIO13, GPIO14, GPIO15 and RST. However, according to the datasheet, these pins only function as GPIO, HSPI, I2S or PWM.
So I don't understand why it is possible to debug Esp8266 with Openocd through these pins when the chip's hardware does not support it? And if the esp8266 hardware really doesn't support the Jtag port, how does the debugger interact with the esp8266? And how does OpenOcd work in this case?

Related

Capturing packets using wireshark of an IoT device

I have an IoT device that connects to my wifi router using wifi. There is a limitation of capturing network logs on the device itself so I thought to capture it using Wireshark.
I am using windows 10 and downloaded the latest version of Wireshark. Now that my laptop and my IoT device connect to the same network through the same router, I am not able to capture the packets in and out from my IoT device.
I put the filer as ip.addr == {ip of the IoT device). But it shows nothing.
Is it possible to capture these packets using a laptop using Wireshark?
Let me know, please.
Thanks
Akhilesh
Is it possible to capture these packets using a laptop using Wireshark?
Yes, but your capture setup is almost certainly incorrect. In a nutshell, you need to be able to capture packets in monitor mode, and you're not doing that. Whether it's possible to do so using the WiFi card on your laptop is unknown, because not all cards support monitor mode on Windows.
Since it's impractical to provide an answer that simply repeats information already provided elsewhere, I'll refer you to the following sites for more detailed information:
The Wireshark WLAN (IEEE 802.11) capture setup wiki page
Jasper Bongertz's blog about Wireless Capture on Windows
See also my answer to this question, which basically provides the same information.

Wireshark wifi traffic not fully listed under monitor mode under OrangePi(Lubuntu)

I‘m trying to monitor traffics under wifi, And I use both a mac and a lubuntu installed Wireshark, and after I enable monitor mode start listening, the amount of lubuntu packs is far less than Mac (10x less)
Does this happen since the CPU or net card things(other hardware things?) or just because of different Wireshark?
Is there any other way to identify this cause? (maybe with some other tool or commands)
added:
maybe related to the channel of wifi, but I config wifi to channel 7 and set the lubuntu monitor channel with
iwconfig wlanxx channel 7
but still, I can't get sniffer traffic under lubuntu but full of them under mac
seems lubuntu only could get the broadcast pack (like arp) and 802.11 Protocol Pack
I'm guessing this due to the bad configuration or implementation of wireless net card
There is probably just more activity on the Mac. I don't know your precise configuration, but if you have a browser open on the Mac and nothing on the lubuntu, then there will be a difference in the amount of network traffic.
There is not really a reason for network traffic to change significantly because of hardware. Configuration can play a role though. If ipv4 and ipv6 are enabled, address resolution packets will be double as if only one is. If Arp cache is set to expire fast, there will also be more Arp traffic.
To identify the cause, look at what wireshark is telling you. What packets are there on both machines ? what packets are unique to the Mac ? Have a look at protocols, destination IPs and port numbers, they are the main clue to tell you what is happening.
It seems due to router's setting( wifi channel and mode(802.11xx))
using channel hopping Tech, For capturing as much as possible packages while hopping through multiple channels
And maybe trying some advanced monitor wireless net card for various mode(802.11xx) and 2.5G/5G supporting

Using Software serial on ESP8266 with Lua

I need to use ESP8266 standalone. I want to connect HM-10 bluetooth module to it and fire its AT commands and read the UUID of devices nearby.
I can do that by firing AT commands on HM-10 from Arduino and FT232RL. But how do I do it in Lua?
Initially I didn't fully understand what the problem is. So, I was reluctant to give an answer based on vague ideas and assumptions. So, it seems you have an Arduino BT from which you send data to an HM-10 which is connected to the ESP8266. What the FT232RL's role is I still don't understand but it doesn't seem relevant in the context of the question.
Wire/solder the HM-10 pins 1 & 2 to the ESP8266 RX/TX. Then you can read data using the NodeMCU UART module: https://nodemcu.readthedocs.org/en/dev/en/modules/uart. uart.on() allows to register callbacks triggered when data is received.
In case your ESP device is a NodeMCU devkit you might have to use uart.alt() depending on which RX/TX pins the HM-10 is connected to. The devkit has more than one set of RX/TX pins, see https://github.com/nodemcu/nodemcu-devkit-v1.0/.

ESP8266 Arduino Hostname (MDNS)

I am having problems with the hostname of my ESP8266. I am using the MDNSResponder and I can successfully access my device with mydevice.local
However, my WiFi router (Netgear WGR614) list the device as ESP_FEA38A. When I use 'Angry IP Scanner' on my mac, there is no hostname listed. Both, the ip scanner and the WiFi router both recognize several raspberrys and other devices like airport express.
Does anybody know what other host naming mechanisms are being used and how I can get my ESP8266 device getting listed with hostname?
If you are using the Arduino environment in the WiFi library there is a method for setting the hostname:
WiFi.hostname(newHostName);
Once I set this to the desired name the ESP8266 showed correctly in DHCP, on the router and, when available, was pingable. From my experimenting this needs to be done before any of the other WiFi actions for it to work effectively.
You can also include the Espressif SDK functionality although looking at the Arduino ESP8266 GitHub project it appears to already be included.
The Espressif SDK sets the hostname with the following command:
wifi_station_set_hostname(myHostname);

Wired connection from iPhone to Raspberry Pi

I would like to build an application on my iPhone that connects to my raspberry Pi. Because these are going to be in close proximity (next to each other), I'd like to use the wired connection (lightning port to USB) to communicate. Is this possible or must I use wireless technologies? My assumption is that wired would be better as it ensures a connection and would be faster, however, I am open to be corrected.
This is related to a hobbyist project where I want to access a raspberry pi sensor on my iphone. The sensor (and Pi) will be next to the iphone. I'm building a custom weird case to combine them.
Any thoughts much appreciated.
Thanks
Iain
For communication with peripheral devices (Raspberry Pi for example) you have several alternatives.
UART via 30-pin or lightning connector (MFi needed)
USB via 30-pin or lightning connector (MFi needed)
Quick start: Microchip's development kits. This module can prolong communication to RPi or you can try to implement the Accessory stack (and communication with authentification chip) to RPi itself.
FSK or similar modulated-audio communication via audio-jack (no MFi needed)
You would have to implement hardware FSK modem on the RPi side and a software one on the iOS side. It is a bit tricky but by no means impossible.
Of course you could implement software modem on the RPi side, too. But since RPi doesn't have audio input you would have to use an USB audio card or something. Or complicate your life trying to sample an analog pin fast enough.
User not really Jake made a quite impressive list of links on this topic here on SO.
Bluetooth as an External Accessory (MFi needed)
Quick start: RN-41/42-APL
Easy to use Bluetooth stack. Communication with authentification chip is handled by the BT module. Note that when communicating with iOS devices data troughput is not much better than when using BLE modules.
Bluetooth as a BLE module (no MFi needed)
Data troughput not much worse then the old BT. Implementing the communication might be a bit more tricky code-wise. This module seems interesting.
WiFi communication (no MFi needed)
WiFi might be a good choice. But for your device and iOS device to be able to find eachother you will need either static IP (for the server device) or minimal Zeroconf (Bonjour) implementation.
When using WiFi you can go either with infrastructure network (using external Access Point) or you could go with AdHoc (created by your device). Later seems promising but be careful - iOS7 & AdHoc network don't seem to work well together yet.
With WiFi you have many modules to choose from. A simpler to use would be a module like RN-XV WiFly Module. TCP stack is already implemented in the module - you can use simple UART communication. I'm not sure how to implement Zeroconf on this one.
Or there are raw WiFi modules like MRF24WG0MA/MB. They are stable and reliable and they can be used on home-etched PCB. Downside for RPi user would be that you would almost certainly need an PIC24 or something between the RPi and MRF24W. Microchip provides free TCP/IP stack for their microcontrollers and this stack includes Zeroconf.
And the easiest way: you could simply use a WiFi dongle (with RPi) for communication. Zeroconf should be easy enough to implement on the RPi - and it's not even needed at the begining if you are ok with assigning static IP to the RPi (if it acts as a server).
This is not possible without signing up for apples MFI program. You have to pay and sign a bunch of NDA's.
https://developer.apple.com/programs/mfi/
You can use other methods, like bluetooth and connection over the audio port.
While #RokJarc's answer is pretty complete, I've also had success with both wired (lightning to usb) and wireless connections using iOS's personal hotspot. Here are the steps:
For wired, on the Pi, install ipheth-utils:
sudo apt-get install ipheth-utils
And add an eth1 network interface by editing /etc/network/interfaces to include:
allow-hotplug eth1
iface eth1 inet manual
For wireless, make sure /etc/network/interfaces has a wireless network entry such as:
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
If you are using wpa_supplicant and add a network entry for the iPhone's hotspot in /etc/wpa_supplicant/wpa_supplicant.conf:
network={
ssid="Banana Phone"
psk="ring ring ring"
key_mgmt=WPA-PSK
id_str="banana"
priority=3
}
The ssid should be the name of the phone from Settings -> General -> About -> Name and the password should come from the personal hotspot screen.
Now start the personal hotspot on your phone. The pi should automatically connect when connected by a usb to lighting cable or using wifi. After connecting, the pi should be assigned an ip somewhere in 172.20.10.x. You can run ifconfig on the pi to figure out which one. (I believe that you should be able to define a static ip here but haven't messed around with that yet)
From there, you can connect another computer to the hotspot and ssh into the pi using the 172.20.10.x ip or even ssh directly from the phone.
In my personal testing, latency over lightning is consistently low and I've used this on both a Raspberry Pi Two and Raspberry Pi Zero for streaming realtime mjpeg video from two cameras to a VR headset. In this scheme, the network is a fairly small source of the 100ms or so latency. The experience is not Vive quality of course, but it is still usable and the iPhone + Pi combo provides lots of fun hacking opportunities
It's possible to do this with Mfi.You can run usbmuxd service on your Raspberry Pi. The usbmuxd will transfer the USB data into socket packets. Your iOS App also need to implement the same protocol to rx/tx the data from/to your Raspberry Pi.
David House has already made this work. https://github.com/davidahouse/PiTalk

Resources