Hi!
I'm trying to use SoftwareSerial on arduino Nano V3. I have compiled and uploaded example from Arduino - Home with zero modifications, but it doesn't work right. I connected FTDI TTL converter to pins 10,11 and ground and writing and reading from same pc to both ports. It works fine if I send from hardware UART to software port, but in other direction when I try to send long string without delays it just passes through only 2-3 first characters. If I add delays (0.1 sec) between sending characters it works fine too, but I need to transfer data at least at 4800bps.
Are the grounds connected? Please post a photo of your setup.
Edit: Removed silly question.
You might want to change to AltSoftSerial, if the pins used there are still free in your project. AltSoftSerial Library, for an extra serial port
pylon:
Are the grounds connected? Please post a photo of your setup.
Right now while trying eliminate possible problems I changed pins to 3,4 and USB-TTL converter to another one (not ftdi), here is photo of current setup:
Code:
#include <SoftwareSerial.h>
SoftwareSerial icom(3, 4);
void setup()
{
Serial.begin(9600);
icom.begin(9600);
}
void loop()
{
if(Serial.available() > 0) {
int b = Serial.read();
icom.write(b);
}
if(icom.available() > 0) {
int c = icom.read();
Serial.write(c);
}
}
Host code:
#!/usr/bin/python
import sys
import serial
import time
data = ''.join([chr(i) for i in range(0, 256)])
s = serial.Serial(sys.argv[1], 9600)
if len(sys.argv)>2:
#s.write(data)
for i in range(0,256):
s.write(data[i])
#time.sleep(0.1)
s.flush()
s.close()
sys.exit(0)
d = s.read(256)
if d!=data:
print repr(data)
print repr(d)
else:
print 'ok'
s.close()
pylon:
You might want to change to AltSoftSerial, if the pins used there are still free in your project. AltSoftSerial Library, for an extra serial port
I'll try it.
bazu:
pylon:
You might want to change to AltSoftSerial, if the pins used there are still free in your project. AltSoftSerial Library, for an extra serial portI'll try it.
Funny thing, AltSoftSerial worked with FTDI converter, but not with cp2102...
I don't use CP21XX converters anymore, I had too much problems with them, so I'm not really surprised. Can you live with the AltSoftSerial solution?