Cannot communicate with ov2640 sensor on ESP32Cam using ZephyrOS - embedded

I've been trying to use Zephyr RTOS and ov2640 cam sensor. I've found the implementation that allows to use this sensor but using espressif SDK, however, I would like to try this using Zephyr.
In general, there is an ov2640 driver sensor available in Zephyr SDK, but I have difficulties using it. I've properly configured a kernel, enabled the driver, and it compiles, but calling the function "device_is_ready" always returns false.
I've enabled the log subsystem and looking at the logs, it seems that the driver fails at early-stage initialization when it tries to read PID and VER registers - in general it's a first attempt to communicate with the sensor.
Here are the logs that are printed to the console when the driver is being initialized:
00:00:01.815,000] <err> i2c_esp32: I2C transfer error: -116
[00:00:01.820,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.825,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.830,000] <err> ov2640: failed to write 0x1 to 0xff
[00:00:01.830,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.835,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.841,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.846,000] <err> ov2640: failed to read 0xa register
[00:00:01.846,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.851,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.856,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.861,000] <err> ov2640: failed to read 0xb register
[00:00:01.861,000] <err> ov2640: OV2640 not detected
The explanation for error codes is as follows:
-116 -> ETIMEDOUT
-14 -> EFAULT
The device tree overlay I've created:
&pinctrl {
i2c_cam: i2c_cam {
pinmux = <I2C0_SDA_GPIO26>,
<I2C0_SCL_GPIO27>;
bias-pull-up;
drive-open-drain;
};
};
&i2c0 {
sda-gpios = <&gpio0 26 (GPIO_PULL_UP | GPIO_OPEN_DRAIN)>;
scl-gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_OPEN_DRAIN)>;
pinctrl-0 = <&i2c_cam>;
pinctrl-names = "default";
ov2640: ov2640#30 {
compatible = "ovti,ov2640";
status = "okay";
reg = <0x30>;
};
};
I don't expect this to be fully working, I would be satisfied if the sensor at least answered with something, then I would know that I'm on the right track, but now it seems that it doesn't respond at all.
I've tested it with Espressif and it works fine.
Does anyone have any idea what's wrong here?

Related

ERROR: configuring avrdude for ATmega328P-XMINI (i think the evildoer is)->(avrdude: usbdev_send(): wrote -5 out of 7 bytes, err = Input/output error)

I have an ATmega328P-XMINI microchip (googling gave me a result that its an 8 bit chip).
Im new to embedded programming. And need some help getting on my way. For now im just trying to establish a connection with avrdude (im just trying to get a healthy connection loading code to the chip comes later). But i get this error. I dont know how to fix this or what is going wrong.
What i do know is that there is an usbdev input output error what i think is the culprit.
The other line exclaiming that the usb device is busy is also suspicous.
DISCLAIMER: I use gentoo and cause of this have no access to atmel studio (I have no access to windows programs).
command issued (tried with and without sudo):
sudo avrdude -p m328p -c xplainedmini
Error code:
avrdude: usb_open(): cannot read serial number "Connection timed out"
avrdude: usb_open(): cannot read product name "Connection timed out"
avrdude: usbdev_open(): WARNING: failed to set configuration 1: Device or resource busy
avrdude: usbdev_send(): wrote -5 out of 7 bytes, err = Input/output error
avrdude: jtag3_send(): failed to send command to serial port
avrdude: failed to sync with the JTAGICE3 in ISP mode
Dmesg after connecting:
[ 7704.920695] usb 2-2: new full-speed USB device number 6 using xhci_hcd
[ 7705.048875] usb 2-2: New USB device found, idVendor=03eb, idProduct=2145, bcdDevice=10.00
[ 7705.048877] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7705.048878] usb 2-2: Product: mEDBG CMSIS-DAP
[ 7705.048880] usb 2-2: Manufacturer: ATMEL
[ 7705.048881] usb 2-2: SerialNumber: ATML2323051800004280
[ 7705.051076] hid-generic 0003:03EB:2145.0003: hiddev97,hidraw1: USB HID v1.11 Device [ATMEL mEDBG CMSIS-DAP] on usb-0000:00:14.0-2/input0
[ 7705.051145] cdc_acm 2-2:1.1: ttyACM0: USB ACM device
microchip documentation and product page
Any tips for debugging this problem in general im thankfull for.
Never mind i spent 20 minutes formulating the question and formatting it. Just to realize that plugging it out and in fixed it.
IM AN IDIOT!

Communicate issue between High-level and RTapp

i am trying to create high-level app based on IntercoreComms samples from azsure-sphere-samples, the high level sample code itself it's working w/o issue on my mt3620 dev board, but when i try to add my code on top of it and run it, there is error message as below from high-level app.
ERROR: Unable to create socket: 13 (Permission denied)
and, the error message from RTApp is as below.
TargetName Type Endian TapName State
0* io0 cortex_m little mt3620.cpu unknown
Info : Listening on port 6666 for tcl connections
Info : Listening on port 23 for telnet connections
Info : clock speed 4800 kHz
Info : SWD DPIDR 0x3ba02477
Info : io0: hardware has 6 breakpoints, 4 watchpoints
Info : io0: external reset detected
Info : Listening on port 4444 for gdb connections
Info : accepting 'gdb' connection on tcp/4444
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x001008ea msp: 0x0012fb90
Warn : target io0 is not halted (gdb fileio)
Polling target io0 failed, trying to reexamine
Info : SWD DPIDR 0x3ba02477
Info : SWD DPIDR 0x3ba02477
Info : SWD DPIDR 0x3ba02477
Info : SWD DPIDR 0x3ba02477
Info : SWD DPIDR 0x3ba02477
To give permission for your high-level app to talk to your real-time app, and vice versa, the "AllowedApplicationConnections" field of the app_manifest.json for each app must contain the component ID of the other app. See here for details. The "ComponentId" is itself a field in the app manfiest: your new app(s) likely have different IDs to the sample apps.
Also, if you are deploying through Visual Studio (Code), you need to declare each app as a 'partner' of the other so one is not deleted when the other is deployed. See here for details of that. The RT app error that you see may come from it being deleted when the high-level app is deployed.

running ARM- fullsystem on gem5

0
I am trying to run ARM-full_system on gem5.when I enter this command for Performance : {root#farideh-S551LN:/home/farideh/gem5# ./build/ARM/gem5.opt configs/example/arm/starter_fs.py --cpu="minor" --num-cores=1 --disk-image=/home/farideh/Downloads/fullsystem/disks/linaro-minimal-aarch64.img --kernel=/home/farideh/Downloads/fullsystem/binaries/vmlinux.vexpress_gem5_v1_64.20170616}
the terminal shows:
{gem5 Simulator System. http://gem5.org gem5 is copyrighted software; use the --copyright option for details. gem5 compiled May 1 2019 08:46:14 gem5 started Jun 2 2019 11:49:47 gem5 executing on farideh-S551LN, pid 7162 command line: ./build/ARM/gem5.opt configs/example/arm/starter_fs.py --cpu=minor --num-cores=1 --disk-image=/home/farideh/Downloads/fullsystem/disks/linaro-minimal-aarch64.img --kernel=/home/farideh/Downloads/fullsystem/binaries/vmlinux.vexpress_gem5_v1_64.20170616 Global frequency set at 1000000000000 ticks per second warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (2048 Mbytes) info: kernel located at: /home/farideh/Downloads/fullsystem/binaries/vmlinux.vexpress_gem5_v1_64.20170616 warn: Bootloader entry point 0x10 overriding reset address 0 warn: Highest ARM exception-level set to AArch32 but bootloader is for AArch64. Assuming you wanted these to match. system.vncserver: Listening for connections on port 5900 system.terminal: Listening for connections on port 3456 0: system.remote_gdb: listening for remote gdb on port 7000 info: Using bootloader at address 0x10 info: Using kernel entry physical address at 0x80080000 info: Loading DTB file: /home/farideh/gem5/m5out/system.dtb at address 0x88000000 warn: Existing EnergyCtrl, but no enabled DVFSHandler found. info: Entering event queue # 0. Starting simulation... warn: ClockedObject: Already in the requested power state, request ignored warn: SCReg: Access to unknown device dcc0:site0:pos0:fn7:dev0}
then I enter telnet 127.0.0.1 3456 in an other terminal and it shows:Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. ==== m5 slave terminal: Terminal 0 ==== }
after several times I confront by this error about telnet:Connection closed by foreign host. and another terminal , I see this:
root#farideh-S551LN:/home/farideh/gem5# ./build/ARM/gem5.opt configs/example/arm/starter_fs.py --cpu="minor" --num-cores=1 --disk-image=/home/farideh/Downloads/fullsystem/disks/linaro-minimal-aarch64.img --kernel=/home/farideh/Downloads/fullsystem/binaries/vmlinux.vexpress_gem5_v1_64.20170616 gem5 Simulator System. http://gem5.org gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled May 1 2019 08:46:14 gem5 started Jun 2 2019 11:49:47 gem5 executing on farideh-S551LN, pid 7162 command line: ./build/ARM/gem5.opt configs/example/arm/starter_fs.py --cpu=minor --num-cores=1 --disk-image=/home/farideh/Downloads/fullsystem/disks/linaro-minimal-aarch64.img --kernel=/home/farideh/Downloads/fullsystem/binaries/vmlinux.vexpress_gem5_v1_64.20170616
Global frequency set at 1000000000000 ticks per second warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (2048 Mbytes) info: kernel located at: /home/farideh/Downloads/fullsystem/binaries/vmlinux.vexpress_gem5_v1_64.20170616 warn: Bootloader entry point 0x10 overriding reset address 0 warn: Highest ARM exception-level set to AArch32 but bootloader is for AArch64. Assuming you wanted these to match. system.vncserver: Listening for connections on port 5900 system.terminal: Listening for connections on port 3456 0: system.remote_gdb: listening for remote gdb on port 7000 info: Using bootloader at address 0x10 info: Using kernel entry physical address at 0x80080000 info: Loading DTB file: /home/farideh/gem5/m5out/system.dtb at address 0x88000000 warn: Existing EnergyCtrl, but no enabled DVFSHandler found. info: Entering event queue # 0. Starting simulation... warn: ClockedObject: Already in the requested power state, request ignored warn: SCReg: Access to unknown device dcc0:site0:pos0:fn7:dev0 33342160250: system.terminal: attach terminal 0 49510353000: system.terminal: detach terminal 0 62922704750: system.terminal: attach terminal 0 warn: Tried to read RealView I/O at offset 0x60 that doesn't exist warn: Tried to read RealView I/O at offset 0x48 that doesn't exist warn: Tried to write RVIO at offset 0xa8 (data 0) that doesn't exist simulate() limit reached # 18446744073709551615 root#farideh-S551LN:/home/farideh/gem5#
I do not know that Arm-fullsystem runs or not and why is telnet shows Connection closed by foreign host?

How to solve: UDP send of xxx bytes failed with error 11 in Ubuntu?

UDP send of XXXX bytes failed with error 11
I am running a WebRTC streaming app on Ubuntu 16.04.
It streams video and audio from Logitec HD Webcam c930e within an Electronjs Desktop App.
It all works fine and smooth running on my other machine Macbook Pro. But on my Ubuntu machine I receive errors after 10-20 seconds when the peer connection is established:
[2743:0513/193817.691636:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1019 bytes failed with error 11
[2743:0513/193817.691775:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1020 bytes failed with error 11
[2743:0513/193817.696615:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1020 bytes failed with error 11
[2743:0513/193817.696777:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1020 bytes failed with error 11
[2743:0513/193817.712369:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1029 bytes failed with error 11
[2743:0513/193817.712952:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1030 bytes failed with error 11
[2743:0513/193817.713086:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1030 bytes failed with error 11
[2743:0513/193817.717713:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1030 bytes failed with error 11
==> Btw, if I do NOT stream audio, but video only. I got the same error but only with the "video" between the Log lines...
somewhere in between the lines I also got one line that says:
[3441:0513/195919.377887:ERROR:stunport.cc(506)] sendto: [0x0000000b] Resource temporarily unavailable
I also looked into sysctl.conf and increased the values there. My currenct sysctl.conf looks like this:
fs.file-max=1048576
fs.inotify.max_user_instances=1048576
fs.inotify.max_user_watches=1048576
fs.nr_open=1048576
net.core.netdev_max_backlog=1048576
net.core.rmem_max=16777216
net.core.somaxconn=65535
net.core.wmem_max=16777216
net.ipv4.tcp_congestion_control=htcp
net.ipv4.ip_local_port_range=1024 65535
net.ipv4.tcp_fin_timeout=5
net.ipv4.tcp_max_orphans=1048576
net.ipv4.tcp_max_syn_backlog=20480
net.ipv4.tcp_max_tw_buckets=400000
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_wmem=4096 65535 16777216
vm.max_map_count=1048576
vm.min_free_kbytes=65535
vm.overcommit_memory=1
vm.swappiness=0
vm.vfs_cache_pressure=50
Like suggested here: https://gist.github.com/cdgraff/7920db287988463aafd7ea09eef6f9f0
It does not seem to help. I am still getting these errors and I experience lagging on the other side.
Additional info: on Ubuntu the Electronjs App connects to Heroku Server (Nodejs) and the other side of the peer connection (Chrome Browser) also connects to it. Heroku Server acts as Handshaking Server to establish WebRTC connection. Both have as configuration:
{'urls': 'stun:stun1.l.google.com:19302'},
{'urls': 'stun:stun2.l.google.com:19302'},
and also an additional Turn Server from numb.viagenie.ca
Connection is established and within the first 10 seconds the quality is very high and there is no lagging at all. But then after 10-20 seconds there is lagging and on the Ubuntu console I am getting these UDP errors.
The PC that Ubuntu is running on:
PROCESSOR / CHIPSET:
CPU Intel Core i3 (2nd Gen) 2310M / 2.1 GHz
Number of Cores: Dual-Core
Cache: 3 MB
64-bit Computing: Yes
Chipset Type: Mobile Intel HM65 Express
RAM:
Memory Speed: 1333 MHz
Memory Specification Compliance: PC3-10600
Technology: DDR3 SDRAM
Installed Size: 4 GB
Rated Memory Speed: 1333 MHz
Graphics
Graphics Processor Intel HD Graphics 3000
Could please anyone give me some hints or anything that could solve this problem?
Thank you
==============EDIT=============
I found in my very large strace log somewhere these two lines:
7671 sendmsg(17, {msg_name(0)=NULL, msg_iov(1)=[{"CHILD_PING\0", 11}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 11
7661 <... recvmsg resumed> {msg_name(0)=NULL, msg_iov(1)=[{"CHILD_PING\0", 12}], msg_controllen=32, [{cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS, {pid=7671, uid=0, gid=0}}], msg_flags=0}, 0) = 11
On top of that, somewhere near when the error happens (at the end of the log file, just before I quit the application) I see in the log file the following:
https://gist.github.com/Mcdane/2342d26923e554483237faf02cc7cfad
First, to get an impression of what is happening in the first place, I'd look with strace. Start your application with
strace -e network -o log.strace -f YOUR_APPLICATION
If your application looks for another running process to turn the work too, start it with parameters so it doesn't do that. For instance, for Chrome, pass in a --user-data-dir value that is different from your default.
Look for = 11 in the output file log.strace afterwards, and look what happened before and after. This will give you a rough picture of what is happening, and you can exclude silly mistakes like sendtos to 0.0.0.0 or so (For this reason, this is also very important information to include in a stackoverflow question, for instance by uploading the output to gist).
It may also be helpful to use Wireshark or another packet capture program to get a rough overview of what is being sent.
Assuming you can confirm with strace that a valid send call is taken place, you can then further analyze the error conditions.
Error 11 is EAGAIN. The documentation of send says when this error is supposed to happen:
EAGAIN (...) The socket is marked nonblocking and the requested operation would block. (...)
EAGAIN (Internet domain datagram sockets) The socket referred to by
sockfd had not previously been bound to an address and, upon
attempting to bind it to an ephemeral port, it was determined that all
port numbers in the ephemeral port range are currently in use. See
the discussion of /proc/sys/net/ipv4/ip_local_port_range in
ip(7).
Both conditions could apply.
The first will be obvious by the strace log if you trace the creation of the socket involved.
To exclude the second, you can run netstat -una (or, if you want to know the programs involved, sudo netstat -unap) to see which ports are open (if you want Stack Overflow users to look into it, post the output on gist or similar and link to it here). Your port range net.ipv4.ip_local_port_range=1024 65535 is not the standard 32768 60999; this looks like you attempted to do something about lacking port numbers already. It would help to trace back to the reason of why you changed that parameter, and the conditions that convinced you to do so.

Bluez 5.37 : Unable to register GATT service with handle

Using Bluez 5.37 bluetoothd. I compile my with flag --disable-systemd.
Using bluetoothctl to connect to my local bluetooth server.
After connecting it does not show any services on dbus.
I can see the following error in bluetoothd log:
bluetoothd[22098]: src/device.c:gatt_debug() start: 0x0001, end: 0x0004, uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[22098]: src/device.c:gatt_debug() start: 0x0010, end: 0x0015, uuid: 00001827-0000-1000-8000-00805f9b34fb
bluetoothd[22098]: src/device.c:gatt_client_ready_cb() status: success, error: 10
bluetoothd[22098]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_XX_XX_XX_XX_BA_8F err 0
bluetoothd[22098]: src/gatt-client.c:btd_gatt_client_ready() GATT client ready
bluetoothd[22098]: src/gatt-client.c:create_services() Exporting objects for GATT services: XX:XX:XX:XX:BA:8F
bluetoothd[22098]: Unable to register GATT service with handle 0x0001 for device XX:XX:XX:XX:BA:8F
bluetoothd[22098]: Unable to register GATT service with handle 0x0010 for device XX:XX:XX:XX:BA:8F
On dbus I cannot see any service or characteristics populated. I need to use bluez 5.37, is there any fix for this?
Note: I have masked bd address as XX:XX:XX:XX:BA:8F
This was basically unable to register the objects on dbus interface.
Resolved this by running bluetoothd in "experimental" mode using "E" flag.
like:
./bluetoothd -ndE