I'm trying to get a LIDAR-Sensor (VL53L1X) working. I connected the Clk-Pin and the SDA-Pin to my Arduino. Then I run the example script (this one). This worked perfectly fine. Then I tried this on my NodeMCU. I connected D1 with CLK and D2 with SDA. I added the Pins in the Wire.begin() line:
Wire.begin(D2, D1);
Now I got this error message:
19:36:40.889 -> load 0x4010f000, len 1384, room 16
19:36:40.889 -> tail 8
19:36:40.889 -> chksum 0x2d
19:36:40.889 -> csum 0x2d
19:36:40.889 -> v8b899c12
19:36:40.889 -> ~ld
19:36:40.957 -> Failed to detect and initialize sensor!
What I'm doing wrong?
I found out that my NodeMCU was broken
Related
I'm working with an ESP at the moment and I have written alot of code that works on it's own, but once merged, it doesn't.
My code boots, but then I get the following;
09:00:18.780 -> Device is now in pay-mode
09:00:18.780 -> ETH Started
09:00:22.779 -> ETH Connected
09:00:22.812 -> ETH MAC: 3C:61:05:30:A9:7F, IPv4: 192.168.207.102, FULL_DUPLEX, 100Mbps
09:00:22.812 -> Registering Device
09:00:22.812 -> Just the main loop
09:00:23.798 -> Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception)
09:00:23.798 -> Debug exception reason: Stack canary watchpoint triggered (network_event)
09:00:23.832 -> Core 1 register dump:
09:00:23.832 -> PC : 0x4011ee2b PS : 0x00060e36 A0 : 0x801120df A1 : 0x3ffb8630
09:00:23.832 -> A2 : 0x3ffb8ca4 A3 : 0x3ffb8ca4 A4 : 0x3ffbc668 A5 : 0x3ffbc65c
09:00:23.832 -> A6 : 0x3ffbc6bc A7 : 0x00000000 A8 : 0xb9e3b68c A9 : 0x00000040
09:00:23.832 -> A10 : 0x7b8a813d A11 : 0x3ffbd650 A12 : 0x3ffb8ca4 A13 : 0x3ffd8ca4
09:00:23.866 -> A14 : 0x5d484383 A15 : 0x37ac32fc SAR : 0x00000010 EXCCAUSE: 0x00000001
09:00:23.866 -> EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000
09:00:23.866 ->
09:00:23.866 -> ELF file SHA256: 0000000000000000
09:00:23.866 ->
09:00:23.866 -> Backtrace: 0x4011ee2b:0x3ffb8630 0x401120dc:0x3ffb8ca0 0x40113175:0x3ffb8cd0 0x4011321b:0x3ffb8d00 0x40121b15:0x3ffb8d30 0x401115ff:0x3ffb8d70 0x401278e8:0x3ffb8d90 0x4012803b:0x3ffb8e20 0x401145f5:0x3ffb8e40 0x40114635:0x3ffb8e60 0x400d4871:0x3ffb8e80 0x400d426b:0x3ffb9100 0x400d4371:0x3ffb9130 0x400d2745:0x3ffb9150 0x400d2ad3:0x3ffb9400 0x400d396a:0x3ffb9470 0x400d3a74:0x3ffb9560 0x40089996:0x3ffb9590
09:00:23.899 ->
09:00:23.899 -> Rebooting...
I have no idea what is going on here, or why I'm getting this error. after a couple of minutes, the main loop just runs (so I get the whole time "Just the main loop" in my console.
I'm using an ETH module and I do some API calls. Can this be that the ESP looses power or doesn't get enough power or so? I'm kinda at a loss why I'm getting this error.
The line "Stack canary watchpoint triggered (network_event)" is your cue. It means the stack overrun detection triggered. One of the tasks (named "network_event") has used more stack that it's been allocated. Give it more.
I'm working with the ESP8266 wifi module programming it in LUA using NodeMCU. I was able to connect from an iPhone app to the TCP server created by the wifi module to send 3 floats. I parse the huge string into 3 strings and send them using uart to and Arduino. It works just fine but after about 10 inputs it crashes/freezes. I need the constant flow of data to keep coming but consistently and I'm unable to do it reliably.
I've printed after each line to keep track of what is actually happening and even after that i'm still not sure what is going on.
Code
`
print("11\n")
wifi.setmode(wifi.STATION)
print("22\n")
wifi.sta.config("WDTS03","Walker14!")
print("33\n")
elWiFi =(wifi.sta.getip())
if elWiFi ~= nil then
print(wifi.sta.getip())
end
print("44\n")
if srv~=nil then
print("444\n")
srv:close()
print("555 \n")
end
print("Create server \n")
srv=net.createServer(net.TCP)
print("1\n")
if srv ~= nil then
print("srv !=nil \n")
srv:listen(6969,function(conn)
print("listening \n")
if conn ~= nil then
print("incoming\n")
conn:on("receive",function(conn,numbers)
print("2\n")
print(#numbers)
print("chekcing for nil \n")
if numbers ~= nil then
print("3\n")
p = string.find(numbers, "x=")
print("4\n")
q = string.find(numbers, "&y")
print("5\n")
if p ~= nill then
print("6\n")
if q ~= nil then
print("7\n")
x = (string.sub(numbers,p+2, q-1))
print("x=" .. x)
end
end --p ~= nill
print("8\n")
p = string.find(numbers, "y=")
print("9\n")
q = string.find(numbers, "&z")
print("10\n")
if p ~= nill then
print("11\n")
if q ~= nil then
print("12\n")
y = (string.sub(numbers,p+2, q-1))
print("y=" .. y)
end
end --p ~= nill
print("13\n")
p = string.find(numbers, "z=")
print("14\n")
q = string.find(numbers, " H")
print("15\n")
if p ~= nill then
print("16\n")
if q ~= nil then
print("17\n")
z = (string.sub(numbers,p+2, q-1))
print("z=" .. z)
end
end-- p ~= nill
print("18\n")
end --numbers ~= nil
print("54\n")
--conn:send("test\n")
end)
print("55 \n")
end
print("66 \n")
end)
print("77\n")
end
print("666\n")`
and I get the following output
11
22
33
44
Create server
1
srv !=nil
77
666
> listening
incoming
55
66
listening
incoming
55
66
listening
incoming
55
66
listening
incoming
55
66
2
338
chekcing for nil
3
4
5
6
7
x=0.1722259521484375
8
9
10
11
12
y=-0.7733306884765625
13
14
15
16
17
z=-0.5716094970703125
18
54
2
337
chekcing for nil
3
4
5
6
7
.
.--repeats a few times
.
y=-0.005340576171875
13
14
15
16
17
z=-0.9838409423828125
18
54
PANIC: unprotected error in call to Lua API (attempt to call a nil value)
�l� �=+���T2n���
NodeMCU 0.9.6 build 20150704 powered by Lua 5.1.4
11
22`
It fails on the "conn:on" argument for "srv:listen" after a few times
Thanks for the help and sorry if formatting is messed up. First time
Too long for a comment, sorry.
PANIC: unprotected error in call to Lua API (attempt to call a nil value)
Hard to tell which value was nil/null. Create a Minimal, Complete, and Verifiable Example (MCVE) to reduce the amount of code one needs to analyze.
The following snippet will eventually lead to out-of-memory due to closed upvalues. Each of your callback functions should use its own copy of the passed socket instance rather referencing the one of a wrapping callback function. The third line should NOT re-use the conn variable but define one with a new name.
See https://stackoverflow.com/a/37379426/131929 for details.
srv:listen(6969,function(conn)
if conn ~= nil then
conn:on("receive",function(conn,numbers)
NodeMCU 0.9.6 build 20150704
Don't use those old 0.9.x binaries, they're outdated and contain lots of bugs. http://nodemcu.readthedocs.io/en/latest/en/#getting-started helps you get started with a new firmware.
I am using the intel XDK for the first time and I am trying to get a reading from this SPI ADC ADS7951SRGER 12 Bit Analog to Digital Converter 8 Input 1 SAR 24-VQFN (4x4) http://www.ti.com/lit/ds/symlink/ads7950.pdf
its connected like so
SPI_2_RXD -> MISO
SPI_2_TXD -> MOSI
SPI_2_CLK -> SCLK
SPI_2_FS0 -> ADC_CS
I have never used SPI before, I am very lost. I've been searching for 24 hours now and I'm not much closer to understanding what I'm supposed to do here.
here is the current hail mary code I'm trying. all I get back is ffffffff
var x = new m.Spi(0);
x.bitPerWord=12;
x.frequency = 20;
var buf = new Buffer(4);
buf[0] = char('0x0b');
buf[1] = char('0x11');
buf[2] = char('0x11');
buf[3] = char('0x11');
var buf2 = x.write(buf);
console.log("Sent: " + buf.toString('hex') + ". Received: " + buf2.toString('hex'));
Any help is appreciated
In the end, I had to pull the CS (SPI_2_FS0 -> ADC_CS) manually, pulling low before each write/read then high again.
I know I've got Perl 5.20.1.1 installed. But can I determine that programmatically?
$] only gives the revision, version and sub-version, i.e. 5.020001 for me, meaning 5.20.1.
The Config module (documented here) doesn't seem to give anything deeper than that. For me:
perl -MConfig -e 'foreach (sort keys %Config) { print "$_ -> $Config{$_}\n" if /version|revision/io; }'
gives:
PERL_API_REVISION -> 5
PERL_API_SUBVERSION -> 0
PERL_API_VERSION -> 20
PERL_REVISION -> 5
PERL_SUBVERSION -> 1
PERL_VERSION -> 20
Revision -> $Revision
SUBVERSION -> 1
api_revision -> 5
api_subversion -> 0
api_version -> 20
api_versionstring -> 5.20.0
ccversion ->
d_inc_version_list ->
d_libm_lib_version ->
db_version_major -> 0
db_version_minor -> 0
db_version_patch -> 0
gccversion -> 4.8.3
gnulibc_version ->
ignore_versioned_solibs ->
inc_version_list ->
inc_version_list_init -> 0
revision -> 5
subversion -> 1
version -> 5.20.1
version_patchlevel_string -> version 20 subversion 1
versiononly ->
I don't think there's anything in there that gives any more information, but it probably doesn't help that in my case the sub-version number is the same as the sub-sub-version number!
Is there anywhere else I can look? Or have I perhaps missed something in %Config?
Official Perl releases only have three parts. "5" is the language, "20" is the major version and "1" is the minor version. Anything more than that was added by someone else (at a guess, whoever packaged the Perl you're using), so you probably will not find it from inside Perl.
I desperately try to get the PRU on my BBB working. By working I mean that I would want to use the pins P8 39-46 (GPIO2[6-13]) as a fast output controlled by the PRU.
I installed the debian for BBB (2 weeks ago, should be current) on SD.
Then I started with the following article: http://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone/blog/2013/05/22/bbb--working-with-the-pru-icssprussv2
doing so, I got the PRU working with the LED example as well as with pin P8[12].
Now I try to get the other pins working. I started all over by just making a little change to the original am335x-boneblack.dtb. I just activated the PRU.
I did not change the LED heartbeat as well as pin P8.12.
Then I disabled HDMI in uEnv.txt
My "slots" look like this now:
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
I stumbled upon this post here: https://groups.google.com/forum/#!topic/beagleboard/JRG36bOURfk
EXACTLY what I would want to have, so I took the dts ( the second one) , compiled it, copied it to /lib/firmware and loaded it. "slots" says the overlay was loaded.
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-PRU-IO
BB-PRU-IO is me.
dmesg says:
... part_number 'BB-PRU-IO', version 'N/A'
... slot #7: generic override
... bone: Using override eeprom data at slot 7
... slot #7: 'Override Board Name,00A0,Override Manuf,BB-PRU-IO'
... slot #7: Requesting part number/version based 'BB-PRU-IO-00A0.dtbo
... slot #7: Requesting firmware 'BB-PRU-IO-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
... slot #7: dtbo 'BB-PRU-IO-00A0.dtbo' loaded; converting to live tree
... slot #7: #2 overlays
... slot #7: Applied #2 overlays.
Looking good I would say.
The problem is the pinmux does not seam to be impressed:
cat pins | grep 8a4
=> pin 41 (44e108a4) 0000002f pinctrl-single
This is MODE 7 (GPIO Out). Not what I wanted. For all of pins I intended to switch to PRU Mode 5.
Now I tried the delivered dtbo's for the PRU 01,02 in /lib/firmware
PRU-01.dtbo seems to be a fitting example. Only the Pin is different (P9.27).
I loaded it and changed the PRU code example.
The pins did not show the expected result:
pin 105 (44e109a4) 00000027 pinctrl-single
When I run the modified testprogram from the first articel my osci shows a flatline.
I tried PRU-02.dtbo.
At least the pins showed the expected result:
pin 105 (44e109a4) 00000025 pinctrl-single
When I start my little test program I get a "bus error"
dmesg has several lines. the important ones I would say are:
[ 119.258978] WARNING: at arch/arm/mach-omap2/omap_hwmod.c:2096 _enable+0x101/0x174()
[ 119.259004] omap_hwmod: pruss: enabled state can only be entered from initialized, idle, or disabled state
[ 119.259027] Modules linked in: g_multi libcomposite btusb bluetooth rfkill uio_pruss mt7601Usta(O)
.... several trace messages
[ 119.272382] pru-rproc 4a300000.prurproc: #8 PRU interrupts registered
[ 119.272445] pru-rproc 4a300000.prurproc: Failed to read events array
[ 119.287545] pru-rproc: probe of 4a300000.prurproc failed with error -22
PRU-02 does more than PRU-01 (what I do not understand). And it does not seem to work for me.
Now I am kind of helpless.
Any ideas on that?
EDIT:
I did what you should not do. I changed the pinmux setting in the am335x-boneblack.dtb file. I just added:
0xA0 0x05
0xA4 0x05
0xA8 0x05
0xAC 0x05
0xB0 0x05
0xB4 0x05
0xB8 0x05
0xBC 0x05
to pinmux_userled_pins {
pinctrl-single,pins = <
Now it works, but I am not happy. I still would appreciate a regular overlay file.
OK I got it working:
just enable the pruss in the am335x-boneblack.dtb (convert to dts. do the changes as described in the article mentioned in the original post)
Got to the website : http://kilobaser.com/blog/2014-07-28-beaglebone-black-devicetreeoverlay-generator#dtogenerator and let the site create dts files for the various pins in my case P8 46-39. Using a single DTS(DTBO) File for each individual pin works but requires 8 dtbos loaded => I moved all of them into one DTS File.
this is it:
/dts-v1/;
/plugin/;
/{
compatible = "ti,beaglebone", "ti,beaglebone-black";
part_number = "BS_PINMODE_PRU_OUT";
exclusive-use =
"P8.46",
"P8.45",
"P8.44",
"P8.43",
"P8.42",
"P8.41",
"P8.40",
"P8.39",
"pr1_pru1_pru_r30_6",
"pr1_pru_pru1_r30_7",
"pr1_pru1_pru_r30_4",
"pr1_pru1_pru_r30_5",
"pr1_pru1_pru_r30_2",
"pr1_pru1_pru_r30_3",
"pr1_pru1_pru_r30_0",
"pr1_pru1_pru_r30_1";
fragment#0 {
target = <&am33xx_pinmux>;
__overlay__ {
bs_pinmode_pru_out: pinmux_bs_pinmode_pru_out {
pinctrl-single,pins = <0x0a4 0x5 0x0a0 0x5 0x0ac 0x5 0x0a8 0x5 0x0b4 0x5 0x0b0 0x5 0x0bc 0x5 0x0b8 0x5>;
};
};
};
fragment#1 {
target = <&ocp>;
__overlay__ {
bs_pinmode_pru_out_pinmux {
compatible = "bone-pinmux-helper";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bs_pinmode_pru_out>;
};
};
};
};
I named the file bspm_pru_out-00A0.dts, compiled it to bspm_pru_out-00A0.dtbo and placed it it in the /lib/firmware.
You can load it via /boot/uEnv.txt or via echo... in a rc.local file... whatever you like.