Upload Arduino sketches to Raspberry Pi via serial port - arduino

I am using the Arduino IDE and RasPiArduino (https://github.com/me-no-dev/RasPiArduino) to compile sketches for my Raspberry Pi Zero. It's working fine.
I figured that the Pi's USB OTG port could be used to directly upload the sketches via USB. So I have set up g_serial on the Pi and successfully logged into it using minicom. The Arduino IDE also lists the port under Tools -> Port. So far so good.
However, I am not yet able to actually upload a sketch over that port or to open the Serial Monitor. As far as I know, the IDE uses avrdude to upload sketches, but it seems that only works for Atmel chips? I am completely stuck here. Can this be done at all? Any ideas or pointers are greatly appreciated.
Thanks!

OK, I got it working as follows, thanks to the tip from jikuja:
Set up ethernet over USB using the gadget driver g_ether You may also have to set up a DHCP server (e.g. dnsmasq) on the Raspberry Pi in order to assign IPs to the Pi and the host. Details can be found here, for instance: https://gist.github.com/gbaman/50b6cca61dd1c3f88f41
Configure avahi to only provide the arduino service over the USB interface. To do this, modify /etc/avahi/avahi-daemon.conf and set options allow-interfaces=usb0 and deny-interfaces=wlan0.
The Arduino IDE (using RaspiArduino) should not be able to detect the Pi on the USB interface, but not the WiFi. Uploading sketches and serial monitor all work fine for me that way. :)

Related

Serial with ESP32 - Arduino Console, Termite work, Putty and Screen on Raspberry Pi don't

I am working with an ESP32-CAM and have run into a bizarre problem with serial communication. I was able to burn the Edge Impulse (https://www.edgeimpulse.com/) firmware onto the ESP32 using a Raspberry Pi and their shell script, which invokes esptool. The firmware appears to write OK. Using esptool to query the chip id seems to work - it returns an id that changes when I swap ESP32 modules. However the Edge Impulse daemon cannot see the ESP32.
This is where it gets really weird. Using screen, I can't see anything on the USB port. I take the ESP32 and cable over to a different computer and I can see the firmware transmitting messages over USB if I use the Arduino serial monitor or the Termite serial program. However if I use Putty I see nothing. No messages, no gobbledygook, nothing at all, even if I reset the ESP32. I have checked (and re-checked) baud, port settings, flow control, local echo, CR/LF. I've tried resetting the ESP32 while watching output from Putty. I've also tried a different PC and gotten the same results.
I'd like to understand what is going on here. Can anyone offer an explanation?
thx
Burned firmware with esptool on Raspberry Pi - works
Queried chip_id with esptool on Raspberry Pi - works
(above shows that serial port, cable and ESP32 are good, I believe)
View USB output with screen and minicom on Raspberry Pi - nothing
View USB output with Arduino serial monitor and Termite from Windows 10 PC - works
View USB output with Putty from Windows 10 PC - nothing

Two way Serial Communication not possible with Qt and Arduino

I am trying to do a sample application using Qt to communicate to Arduino board DUE.
But When one communication is started other is not able to connect,meaning when i start my Arduino first I am not able to start Qt application to read or write data and viceversa.
Can anybody tell me whether this is possible if Yes please help me in this and i ll try to post my sample code.
If I understand your question correctly, you want to be able to connect to your Arduino device (via its USB to RS232 converter) while the Arduino IDE, and thus, the serial monitor is running.
If that's the case, that is simply not possible. Not because of Qt, nor because of Arduino. That's the way serial ports work. You can't connect to the same port twice from different processes.
Since the microcontroller on the Arduino DUE has 4 UARTS, you may consider using one of them (with another USB to serial adapter, and thus, having another COM port showing up on your PC) to interface the board with your Qt application while the Arduino IDE is still connected to the "main" serial port.
Also, keep in mind that the Arduino Due works with 3.3 V, so ensure that the USB to serial adapter is compatbile with that voltage range.

Implementing I2C slave with FT201XB via USB

I've been trying to test a FT201XQ USB-I2C breakout board: UMFT201XB-01, so I can connect it to a master device such as an Arduino and sniff what that device is sending through I2C.
To see the output of the slave device I have successfully configured a Virtual COM PORT by installing the D2XX drivers provided by ftdchip.com. I can open the serial port through puTTY and everything seems fine in that regard.
Then, i've loaded the "master_writer" example on my Arduino, which sends 1 byte at a time to an address (0x22 is specified in the UM201XB-01 datasheet as the default address).
Nothing seems to happen in the COM port that i've earlier opened. Do I need to configure/program the FTDI device in some way? In that case, how can I do it, in a general way?
UMFT201XB-01 board http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_UMFT201_220_230XB.pdf
Thank you in advance, and sorry if this is a "noob" question : P

Arduino Yun WifiStatus Example Failing

I am able to connect and upload the WifiStatus example per the instructions on the Arduino Site/Examples/Yun. However, when I hit the serial monitor button it is supposed to print out the relevant Wifi stats, instead it says "unable to connect" and the final line goes a bit further..."unable to connect: is the sketch using the bridge". Any ideas? A post suggested reseting the 32U4, which I did, but no luck.
Incidently, all of this is over Wifi. Board and port are set per instructions. Yun pings fine and receives the uploaded sketch fine.
More code is usually more illuminating... so you might get better answers when you provide more information.
"is the sketch using the bridge" seems to indicate that there is some problem with the Bridge library. Is it being initialized? Did initialization (i.e., "Bridge.begin()" succeed?
A sketch with bridge functional and serial monitor via network connection cannot be running simultaneously as they use the same hardware connection.
You may use the serial monitor via USB port, or Serial TX/RX pins, or SoftwareSerial for this.

Virtual com communications with no usb2uart bridge?

I'd like to connect a beagleboard-like (custom developed) omap board to a Windows PC using a virtual-com setup. That is, i'd like the board to appear to Windows as a com device and get the COM to send data to our application on the board. The main reason for that is to use virtual-com drivers on windows, since the usb drivers we use now to directly sent data over usb between the host and the board seem not to work properly.
I have done this using the FTDI driver on the past but as far as i know it worked because the device had an FTDI chip that translated the usb protocol to serial signals (am i right ?).If there's no USB to UART bridge on the board, how could i do that ?
By the way, how USB Communication Device Classes fits here ? Should develop a CDC driver for the board ? What should I use then on Windows side ?
I'm kind of confused, so any help will be greatly appreciated :)
Well, i answer myself :)
The solution lies in the Linux USB Gadget Subsystem.
Gadget API

Resources