I am trying to work with the (new) sparkfun razor IMU 9dof, I wrote a silple sktetch to calibrate the magnetometer:
#include <SparkFunMPU9250-DMP.h> // Include SparkFun MPU-9250-DMP library
#include <Wire.h> // Depending on your Arduino version, you may need to include Wire.h
MPU9250_DMP imu; // Create an instance of the MPU9250_DMP clas
void setup() {
Serial.begin(115200);
Serial.println(F("Adafruit 10 DOF Board AHRS Calibration Example")); Serial.println("");
if (imu.begin() != INV_SUCCESS){
while (1) {
Serial.println("Failed to initialize MPU-9250, loop forever");
}
}
imu.setGyroFSR(2000); // Set gyro to 2000 dps
imu.setAccelFSR(2); // Set accel to +/-2g
imu.setLPF(5); // Set LPF corner frequency to 5Hz
imu.setSampleRate(100); // Set sample rate to 10Hz
imu.setCompassSampleRate(100); // Set mag rate to 10Hz
}
void loop(void){
imu.update();
// Print the sensor data
Serial.print("Raw:");
Serial.print(imu.ax);
Serial.print(',');
Serial.print(imu.ay);
Serial.print(',');
Serial.print(imu.az);
Serial.print(',');
Serial.print(imu.gx);
Serial.print(',');
Serial.print(imu.gy);
Serial.print(',');
Serial.print(imu.gz);
Serial.print(',');
Serial.print(imu.mx);
Serial.print(',');
Serial.print(imu.my);
Serial.print(',');
Serial.print(imu.mz);
Serial.println();
delay(50);
}
To be sure the Arduino IDE can access to dev/ttcACM0, I did sudo chmod 666 /dev/ttyACM0
I can dowload successfully but when I want to open the terminal I got the following error:
Erreur d'ouverture du port série « /dev/ttyACM0 ». (Port busy) (see attached screenshot)
More over when I entered dmesg on the console, I can see the following messages:
[ 94.133923] usb 3-2: USB disconnect, device number 2
[ 94.133978] cdc_acm 3-2:1.1: urb 12 failed submission with -19
[ 94.135862] cdc_acm 3-2:1.1: urb 13 failed submission with -19
[ 94.136059] cdc_acm 3-2:1.1: urb 14 failed submission with -19
[ 94.136257] cdc_acm 3-2:1.1: urb 15 failed submission with -19
[ 94.136457] cdc_acm 3-2:1.1: urb 2 failed submission with -19
[ 94.136656] cdc_acm 3-2:1.1: urb 3 failed submission with -19
[ 94.136852] cdc_acm 3-2:1.1: urb 5 failed submission with -19
[ 94.137048] cdc_acm 3-2:1.1: urb 6 failed submission with -19
[ 94.138841] xhci_hcd .&checktime(0000,03,00,':').0: WARN Cannot submit Set TR Deq Ptr
[ 94.138843] xhci_hcd .&checktime(0000,03,00,':').0: A Set TR Deq Ptr command is pending.
[ 94.931853] usb 3-2: new full-speed USB device number 3 using xhci_hcd
[ 95.316578] usb 3-2: New USB device found, idVendor=1b4f, idProduct=9d0f
[ 95.316581] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 95.316582] usb 3-2: Product: SFE 9DOF-D21
[ 95.316584] usb 3-2: Manufacturer: SparkFun
[ 95.320306] cdc_acm 3-2:1.0: ttyACM0: USB ACM device
[ 858.774849] usb 3-2: USB disconnect, device number 3
[ 904.529058] TCP: wlp1s0: Driver has suspect GRO implementation, TCP performance may be compromised.
Does anyone outhere experienced such issue?
Thank you for your help
Fabrice
4 Answers 4
sudo apt-get purge modemmanager
It helps me for linux user and for many other peoples.
Now I am playing with stm32f103 and opening port was painfull.
That was problem only for stm32 chip. Arduino nano was working without problems.
Before I need reopened few times port to initiate communication.
That was painfull. After finding that solution now Arduino ID is working without problems.
I am not sure if deleting modemmanager will have impact for my system.
I solved following serial port related problems in ubuntu 18.04 as follows:
Problem 1 : Cannot open /dev/ttyACM0: Permission denied
Solution : Grant permissions to read/write to the serial port with this terminal command ---> sudo chmod a+rw /dev/ttyACM0
Here replace tty port with your respective ubuntu port.
Problem 2 : Failed to open /dev/ttyACM0 (port busy)
Solution : This problem appears when serial port is busy or already occupied. So kill the busy serial port with command ---> fuser -k /dev/ttyACM0
. Here replace tty port with your respective ubuntu port.
Problem 3 : Board at /dev/ttyACM0 is not available Solution : In this case, your serial port in tools menu will be greyed out. I googled a lot for this, but none of solution worked for me. Atlast I tried different arduino board and usb connector and it was working for me. So, if you are having old arduino board (can be solved using required drivers) or defected arduino board then only this problem arises.
When I had this problem I discovered that running ps x
showed a lot of tasks involving temporary mount files. So I closed Arduino, ran sudo rm -rf /tmp/.mount_arduin*
and restarted Arduino. The device attached successfully.
You need to be part of the dial out group. Try this: Type 'groups', is 'dialout' there ? sudo usermod -a -G tty yourUserName Example sudo usermod -a -G tty gil
Log off and log on again for the changes to take effect. This has consistently worked for me and is now in some of the Arduino install packages.
modemmanager
package.lsof | grep ttyACM
to see which process is holding the port (might possibly need to run lsof as root, but try it first as yourself)