Hello everybody, I’ve a very singular problem…
I’m using an arducam multi camera adapter v2.2. For the moment, I’ve two camera connected.
I’m using the AdapterTestDemo.py
program from the source code released from Arducam:
https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.2_python/AdapterTestDemo.py
The scenario is: I receive a message on a socket, and then I execute the program. Very simple.
Until this point, everything works fine. I boot up the Raspberry Pi, start the socket and send a message on that. The two photos are taken perfectly.
Now, the problem is:
If I execute the socket program at boot (not manually) and the try to execute AdapterTestDemo.py
:
Start testing the camera A
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
Start testing the camera B
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
This happens independently from the socket. The socket does nothing. Simply execute the linux command python ./AdapterTestDemo.py
. I’m sure the problem is not the socket, because I’ve tried with different sockets in different programmation languages. How is that possible?
I attach AdapterTestDemo.py
and socket.js
:
import RPi.GPIO as gp
import os
gp.setwarnings(False)
gp.setmode(gp.BOARD)
gp.setup(7, gp.OUT)
gp.setup(11, gp.OUT)
gp.setup(12, gp.OUT)
def main():
print('Start testing the camera A')
i2c = "i2cset -y 1 0x70 0x00 0x04"
os.system(i2c)
gp.output(7, False)
gp.output(11, False)
gp.output(12, True)
capture(1)
print('Start testing the camera B')
i2c = "i2cset -y 1 0x70 0x00 0x05"
os.system(i2c)
gp.output(7, True)
gp.output(11, False)
gp.output(12, True)
capture(2)
def capture(cam):
cmd = "raspistill -t 1 -n -o ./capture_%d.jpg" % cam
os.system(cmd)
if __name__ == "__main__":
main()
gp.output(7, False)
gp.output(11, False)
gp.output(12, True)
var udp = require('dgram');
const { exec } = require('child_process');
// --------------------creating a udp server --------------------
// creating a udp server
var server = udp.createSocket('udp4');
// emits when any error occurs
server.on('error',function(error){
console.log('Error: ' + error);
server.close();
});
// emits on new datagram msg
server.on('message',function(msg,info){
console.log('Data received from client : ' + msg.toString());
console.log('Received %d bytes from %s:%d\n',msg.length, info.address, info.port);
exec('python /home/pi/js/RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.2_python/AdapterTestDemo.py', (err, stdout, stderr) => {
if (err) {
// node couldn't execute the command
return;
}
// the *entire* stdout and stderr (buffered)
console.log(`stdout: ${stdout}`);
console.log(`stdout: ${stderr}`);
});
});
//emits when socket is ready and listening for datagram msgs
server.on('listening',function(){
var address = server.address();
var port = address.port;
var family = address.family;
var ipaddr = address.address;
console.log('Server is listening at port' + port);
console.log('Server ip :' + ipaddr);
console.log('Server is IP4/IP6 : ' + family);
});
//emits after the socket is closed using socket.close();
server.on('close',function(){
console.log('Socket is closed !');
});
server.bind(2222);
setTimeout(function(){
server.close();
},900000);