I am trying to use ESP8266 and it's my first time to use WIFI module,
I have some question,
How can I translate the AT Command response?,
Can I just use it out-of-box or Do I have to update it's SDK? if No, I have to update it,then How can I update it through my MCU?
I've established connection with it and when I send
"AT+GMR\r\n"
it responds with
"AT+GMR\r\r\nAT+GMR\rb.R Tb.R Tb.R Tb+R+Tb.R Tb.R Tb.R Tb.R Tb.R Tv0(205Do\rnhC\r1S08\rOMGs\n\r.Gs\n\r.Gs\n\r.Gs\n\r.Gs\n\r.Gs\nr4u1:Kn\nkno\n.e1:\nETA\n.MyA\n.MyA\n.MyA\n.MyA\n.MyA :0 :\ns.heydd2 :OR+Tb.R Tb.R Tb.R Tb.R Tb.R Tb""AT+GMR\r\r\nAT+GMR\rb.R Tb.R Tb.R Tb+R+Tb.R Tb.R Tb.R Tb.R Tb.R Tv0(205Do\rnhC\r1S08\rOMGs\n\r.Gs\n\r.Gs\n\r.Gs\n\r.Gs\n\r.Gs\nr4u1:Kn\nkno\n.e1:\nETA\n.MyA\n.MyA\n.MyA\n.MyA\n.MyA :0 :\ns.heydd2 :OR+Tb.R Tb.R Tb.R Tb.R Tb.R Tb"
I understand that it should be version of AT command and SDK version. But it doesn't look like it is any useful data(excuse my confusion) so how can I understand it?
one more question, is there any useful documentation or datasheet for it? i am asking this because all what i can find online is for specific target or for arduino
Garbage like that could be due to mismatching baud rates. Have you tested with different speeds? If not you should iterate over all common baud rates to see if one of them works. Classical modems supported autobauding, but that is not very common for embedded wifi modules.
Also, notice that the clock speed of your microcontroller significantly influences what baud rates you can use reliably, see this answer for more details.
Related
I'm evaluating k6 for my load testing needs. I've set up a basic load test and I'm currently trying to interpret the error messages and result values I get. Maybe someone can help me interpret what I'm seeing:
If I crank up the VUS to about 300, I start seeing error messages in the console and at 500 lots of error messages.
These mostly consist of:
dial tcp XXX:443: i/o timeout
read tcp YYY(local ip):35252->XXX(host ip):443: read: connection reset by peer
level=warning msg="Request Failed" error="unexpected EOF"
Get https://REQUEST_URL/: context deadline exceeded"
I also have problems with several checks:
check errors in which res.status === 0 and res.body === null
check errors in which res.status === 0, but the body contains the correct content
How can res.status be 0 but the body still contains the proper values?
I suspect that I'm reaching the connection limit of my load producing machine and that's why I get the error messages. So I'd have to set up a cluster or move to the Cloud runners!?
The stats generated by k6 show long http_req_blocked values, which I interpret as the time waiting to get a connection port. This seems to indicate that the connection pool of my test running machine is at its limits.
http_req_blocked...........: avg=5.66s min=0s med=3.26s max=59.38s p(90)=13.12s p(95)=20.31s
http_req_connecting........: avg=1.85s min=0s med=280.16ms max=24.27s p(90)=4.2s p(95)=9.24s
http_req_duration..........: avg=2.05s min=0s med=496.24ms max=1m0s p(90)=4.7s p(95)=8.39s
http_req_receiving.........: avg=600.94ms min=0s med=82.89µs max=58.8s p(90)=436.95ms p(95)=2.67s
http_req_sending...........: avg=1.42ms min=0s med=35.8µs max=11.76s p(90)=56.22µs p(95)=62.45µs
http_req_tls_handshaking...: avg=3.85s min=0s med=1.78s max=58.49s p(90)=8.93s p(95)=15.81s
http_req_waiting...........: avg=1.45s min=0s med=399.43ms max=1m0s p(90)=3.23s p(95)=5.87s
Can anyone help me out interpret the results I'm seeing?
You are likely running out of CPU on the runner.
As explained in the http specific metrics of the documentation, you are right about http_req_blocked it is (mostly) the time from when we say we want to make a
request to when we get a socket on which to do it. This is most likely because:
the test runner is running out of CPU and can't handle both making all the other request and starting new
the system under test is running out of CPU and has ... the same problem
You will need to monitor them (you are highly advised to do this regardless) as test at 100% runner CPUs are probably not very representable :) and you likely don't want the system you are testing to get to 100% as well.
The status code === 0 means that we couldn't make the request/read the response ... for some reason, usually explained by the error and error_code.
As I commented if you have status code 0 and a body this is most likely a bug ... at least I don't remember there being a case where this won't be true.
The errors you have list mean (most likely):
dial tcp XXX:443: i/o timeout
this is literally we tried to get a tcp connection and it took too long (probably the reason for the big http_req_blocking)
read tcp YYY(local ip):35252->XXX(host ip):443: read: connection reset by peer
the other side closed the connection .. likely because some timeout was reached - for example, if we don't read over 30 seconds the server decides that we won't read anymore and closes it ... and in the case where CPU is 100% there is a good chance some connection won't get time to be read from.
level=warning msg="Request Failed" error="unexpected EOF"
literally, what it says .. the connection was closed when we totally didn't expect, or more accurately the golang net/http stdlib didn't expect. Likely again a timeout just at a point in the life of the request where the other errors aren't returned.
Get https://REQUEST_URL/: context deadline exceeded"
This is because a request took longer then the timeout (by default 60s) and will at some point be changed to a better error message.
I've been trying to make the serial communication work on my BBB for days now and I am running out of ideas.
When I use just the BBB and connect MISO/MOSI I get the signal transfer on MOSI, SCLK and CS (MISO is mainly at high level). However, when I connect the lines to my slave part it does not work. I checked the signals on the oscilloscope and they seem fine and the part which I am using as the slave is working well when I set it in parallel mode, so I believe some programming or configuration must be wrong.
This is basically what I do:
config-pin P9.17 spi_cs
config-pin P9.18 spi
config-pin P9.21 spi
config-pin P9.22 spi_sclk
python
from Adafruit_BBIO.SPI import SPI
spi = SPI(1,0) #I would expect SPI(0,0) here, but I get the signal on the above configured ports
Then I set the configurations (already tried in many ways):
spi.mode = 0
spi.cshigh = False
spi.msh = 10500000
spi.bpw = 16
spi.lsbfirst = False
After that I open it and try to send data:
spi.open(1,0)
spi.xfer2([1,254])
If anyone is interested, I am trying to program the LMH6517 as slave and I already tried to ask about this at the TI forum here:
https://e2e.ti.com/support/amplifiers/f/14/t/751415
Oscilloscope images:
CS and SCLK
MOSI and SCLK
MISO and SCLK
Thank you,
JPL
I have a problem with NodeMCU, trying to start a tmr.alarm on a esp8266.
tmr.alarm never starts the timer, and always returns false.
I've tried changing the timer, and even changing the type of the alarm (AUTO, SINGLE...) but i always have the same result.
Here's part of the code, i'm trying to comunicate with a DS18B20 (OneWire temperature sensor) once every 5 seconds or so.
if not tmr.alarm(1, 5000, tmr.ALARM_AUTO, function()
-- Comunication with the sensor
end)
then print("Comunication with DS18B20 couldn't be started.") end
The output is always
Comunication with DS18B20 couldn't be started.
Don't use the old 0.9.x NodeMCU binaries from https://github.com/nodemcu/nodemcu-firmware/releases they're no longer supported and contain lots of bugs. Build a custom firmware from the dev or master branch.
I'm not aware of any timer bugs in recent versions.
I am communicating with CUPS using IPP protocol. I have all drivers for my printers installed in CUPS (using .ppd file) and printers got latest firmware.
When I query a job which a printer printing right now it says that the job's state is 'complete' before the printer even finish printing. It seems that the CUPS marks the job as 'complete' when it finish 'uploading' the file.
I would not expect this behaviour and I basically need to know when exactly the printer printed last paper for a job.
The code looks as follow. The self.printer().ippPrinter() is an instance of node-ipp and it points to a printer. To read the the state of the job I am using attribute 'job-state'.
var msg = {
"operation-attributes-tag": {
'job-id': id
}
};
self.printer().ippPrinter().execute("Get-Job-Attributes", msg, function(err, res){
var attributes = res['job-attributes-tag'];
self.setAttributes = attributes;
callback.call(self, attributes);
});
Does anyone know why I am having this issue or .. how to make it working?
Thank you!
CUPS can only forward job-states received from the printer. A lot of printer drivers and protocols work like 'fire and forget'.
Usually IPP printers allow CUPS and other clients to monitor the current job-state until it's finished/printed. Some manufacturers don't implement IPP properly and classify submitted jobs as printed - even if the printer has a paper jam!
Conclusion:
If your printer does not fully support IPP you probably won't be able to check for 'printed successfully'.
RFC 8011 5.3.7.1
If the implementation is a gateway to a printing system that never provides detailed status about the Print Job, the implementation MAY set the IPP Job’s state to ’completed’, provided that it also sets the ’queued-in-device’ value in the Job’s "job-state-reasons" attribute
#Jakub, you may well be communicating with CUPS using IPP... But are you sure that CUPS is communicating with the print device via IPP?
You can check this by running
lpstat -h cupsservername -v
This should return the device URI assigned to each print queue, which CUPS uses to address the actual printing device:
If that URI does contain ipp://, ipps://, http:// or https:// CUPS indeed talks IPP to the print device and you should be able to get actually correct status messages.
But if you see socket:// then CUPS is configured to use the AppSocket method (sometimes also called 'HP Jet Direct' or 'IP Direct Printing') to forward jobs. This is a "fire and forget" protocol. Basically it is the same as if you did run netcat print-device 9100 < myprintfile to shovel the printable data to port 9100 of the printer. The CUPS socket backend handling this spooling to the printer will not get any other acknoledgement from the printer than what TCP/IP provides confirming that the last packet was transfered. Hence it has to close down its process and report to the CUPS daemon successful-ok, even if the printer is still busy spitting out lots paper and will maybe never complete the full job because it runs into a paper jam...
If you see lpd:// the situation is similar (but uses port 515).
You may have success with a full status reporting by switching the CUPS-to-printdevice path from AppSocket or LPD to IPP like so:
sudo lpadmin -p printername ipp://ipaddress-of-printer
or
sudo lpadmin -p printername http://ipaddress-of-printer:631
I'm stumped trying to get etherOutputHookAdd() to work. Its counterpart, etherInputHookAdd(), seems to work fine. The OS version in question is VxWorks 5.4 .
The hook code looks like so (the code I intend to actually run is more complicated, but this serves for an example.)
int anCounter;
STATUS etherHook(struct ifnet *pif, char *buf, int size)
{
anCounter += 1;
return FALSE;
}
I can hook up etherInputHookAdd from the vxworks shell like so
etherInputHookAdd etherHook,"fei",0
This returns 0 (STATUS OK), after which examination of the 'anCounter' variable will indicate activity as expected. However, no such luck with the output direction. I've tried both of these command lines
etherOutputHookAdd etherHook,"fei",0
etherOutputHookAdd etherHook
Both of these return OK, but the hook routine doesn't seem to be getting called at all. My best hypotheses are (1) I'm missing an initialization step, or calling it wrong, (2) the etherOutputHookAdd implementation is just a stub, (3) you just can't call it from the shell, or (4) maybe my nic driver implementation is buggy.
Any ideas that solve the central problem - how do I see what's being sent off my board - are welcome.
The following VxWorks network drivers support both the input-hook and output-hook routines:
if_cpm - Motorola MC68EN360 QUICC network interface driver
if_eex - Intel EtherExpress 16
if_ei - Intel 82596 ethernet driver
if_elc - SMC 8013WC Ethernet driver
if_elt - 3Com 3C509 Ethernet driver
if_ene - Novell/Eagle NE2000 network driver
if_fn - Fujitsu MB86960 NICE Ethernet driver
if_ln - Advanced Micro Devices Am7990 LANCE Ethernet driver
if_sm - shared memory backplane network interface driver
if_sn - National Semiconductor DP83932B SONIC Ethernet driver
if_ultra - SMC Elite Ultra Ethernet network interface driver
if_gn - generic MUX interface layer
The following drivers support only the input-hook routines:
if_nic - National Semiconductor SNIC Chip (for HKV30)
if_sl - Serial Line IP (SLIP) network interface driver
The following drivers support only the output-hook routines:
if_ulip - network interface driver for User Level IP (VxSim)
The following drivers do not support either the input-hook or output-hook routines:
if_loop - software loopback network interface driver
To those few who might stumble this way .. It was the horrible 'hypothesis 4'!
It turns out that in order for etherOutputHookAdd() to work correctly, it is incumbent on the NIC device driver writer to include a call to the function pointed to by etherOutputHookRtn. All etherOutputHookAdd() does is add your proffered packet handler to a list, so that when a NIC driver calls etherOutputHookRtn, you get a copy of what's being transmitted. Sadly, there are many drivers where for whatever reason, this was simply not done.
So in cases such as this one, there are only two courses of action.
find a patch for your driver, or patch it yourself
change tactics entirely, e.g., try using etherInputHookAdd() on the other side.
In case you migrate to a newer version (>6.x) of VxWorks , etherLib is no longer supported. Instead, one can use muxLib for a similar purpose.
Hook inbound traffic: Use muxBind with MUX_PROTO_PROMISC or MUX_PROTO_OUTPUT.
Hook outbound traffic: Use muxBind with MUX_PROTO_OUTPUT.
You should provide a callback routine in both cases.