Show Posts
Pages: 1 [2] 3 4 ... 60
16  Products / Arduino Yún / Re: Tty for serial port to Arduino from Linino on: October 10, 2013, 05:55:50 am
Can you retry with 250000 baud? That's the speed we set for ttyATH0
Doesn't work. For some reason I get incomplete readings for all speeds above 115200 baud. (230400, 250000 etc.)
I also tried to write smaller data packets of 16 bytes instead of 32 bytes, but no luck. Every baudrate above 115200 baud fails on the first write/read cycle.

But 115200 baud (10kB/s) is fast enough for most usecases where data from the ATmega32u4 is  being forwarded to a webservice.
I can live with that limitation.
17  Products / Arduino Yún / Re: Tty for serial port to Arduino from Linino on: October 10, 2013, 02:52:18 am
Out of curiosity: could you set up a stress test case?
Something like flooding the 32u4 with random chars (in a 1.000.000 rounds "for" loop) and checking if the output is the expected one
I did some quick tests. In short...
  • The maximum baudrate is 115200 baud. Tests with 230400 baud  always failed on the first read attempt.
  • With the simple Arduino Sketch (see below) the IO-throughput is about 10kB/s.

The baudrate in the python script and the Arduino Sketch must (obviously) match to make this work

Here is the python script for testing
Code:
"""
Usage :
    python st.py PORT BAUDRATE KILO_BYTES

example :
python st.py /dev/ttyATH0 115200 10
Will send and receive 10kB of data

turn on profiling:
python -m cProfile st.py /dev/ttyATH0 115200 10
"""

import serial
import sys

data='01234567012345670123456701234567'
expected='12345678123456781234567812345678'

#one packet is 32 bytes so 1kByte is 32 packets
packets=int(sys.argv[3])*32
s=serial.Serial(sys.argv[1],sys.argv[2],timeout=5)
for i in range(packets):
    s.write(data)
    result=s.read(32)
    if result!=expected:
        raise ValueError('Mismatch on run : '+str(i)+'\ndata = "'+data+'"\nresult = "'+result+'"')
print "Done!"
s.close()

On the Arduino I run this Sketch. It blinks the Led after coming out of a reset.
Code:
void setup() {
  pinMode(13,OUTPUT);
  digitalWrite(13,HIGH);
  delay(500);
  digitalWrite(13,LOW);
  delay(500);
  digitalWrite(13,HIGH);
  delay(500);
  digitalWrite(13,LOW);
  Serial1.begin(115200);
 
}

void loop() {
  char c;
 
  while (Serial1.available() > 0) {
    c=Serial1.read();
    c++;
    Serial1.print(c);
  }
 
}


Here is the output of the longest test I ran  (4MB of data).
Takes about 7 minutes to complete!
Code:
root@YunYun:/mnt/sda1/python# python -m cProfile st.py /dev/ttyATH0 115200 4096
Done!
         5392556 function calls in 431.015 seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.005    0.005    0.026    0.026 __init__.py:8(<module>)
        1    0.017    0.017    0.022    0.022 serialposix.py:13(<module>)
        1    0.000    0.000    0.000    0.000 serialposix.py:163(Serial)
        1    0.000    0.000    0.001    0.001 serialposix.py:168(open)
        1    0.001    0.001    0.001    0.001 serialposix.py:192(_reconfigurePort)
        1    0.000    0.000    0.000    0.000 serialposix.py:321(close)
   131072  189.347    0.001  392.045    0.003 serialposix.py:340(read)
   131072   11.837    0.000   25.662    0.000 serialposix.py:359(write)
        1    0.001    0.001    0.001    0.001 serialutil.py:111(SerialBase)
        1    0.001    0.001    0.002    0.002 serialutil.py:123(__init__)
        1    0.000    0.000    0.000    0.000 serialutil.py:196(setPort)
        1    0.000    0.000    0.000    0.000 serialutil.py:221(setBaudrate)
        1    0.000    0.000    0.000    0.000 serialutil.py:240(setByteSize)
        1    0.000    0.000    0.000    0.000 serialutil.py:253(setParity)
        1    0.000    0.000    0.000    0.000 serialutil.py:266(setStopbits)
        1    0.000    0.000    0.000    0.000 serialutil.py:279(setTimeout)
        1    0.000    0.000    0.000    0.000 serialutil.py:298(setWriteTimeout)
        1    0.000    0.000    0.000    0.000 serialutil.py:30(SerialException)
        1    0.000    0.000    0.000    0.000 serialutil.py:317(setXonXoff)
        1    0.000    0.000    0.000    0.000 serialutil.py:328(setRtsCts)
        1    0.000    0.000    0.000    0.000 serialutil.py:339(setDsrDtr)
        1    0.000    0.000    0.000    0.000 serialutil.py:35(SerialTimeoutException)
        1    0.000    0.000    0.000    0.000 serialutil.py:355(setInterCharTimeout)
        1    0.000    0.000    0.000    0.000 serialutil.py:40(FileLike)
        1    0.003    0.003    0.004    0.004 serialutil.py:8(<module>)
        1   13.242   13.242  431.015  431.015 st.py:14(<module>)
        3    0.000    0.000    0.000    0.000 {_struct.pack}
        2    0.000    0.000    0.000    0.000 {chr}
        3    0.000    0.000    0.000    0.000 {getattr}
       21    0.000    0.000    0.000    0.000 {hasattr}
   131072    1.061    0.000    1.061    0.000 {isinstance}
  2565176   21.640    0.000   21.640    0.000 {len}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        1    0.000    0.000    0.000    0.000 {method 'lower' of 'str' objects}
        1    0.000    0.000    0.000    0.000 {posix.close}
        1    0.000    0.000    0.000    0.000 {posix.open}
  1151516   62.691    0.000   62.691    0.000 {posix.read}
   131072   12.070    0.000   12.070    0.000 {posix.write}
        1    0.038    0.038    0.038    0.038 {range}
  1151516  119.062    0.000  119.062    0.000 {select.select}
        1    0.000    0.000    0.000    0.000 {termios.tcgetattr}
        1    0.000    0.000    0.000    0.000 {termios.tcsetattr}
18  Products / Arduino Yún / Re: Tty for serial port to Arduino from Linino on: October 09, 2013, 09:48:29 am
Hi,
with the tips in this thread I was able to do some very basic IO from python to the atmega:

I disabled the login on ttyATH0 by editing the the file /etc/inittab
Code:
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
#disable the login console on this serial by commenting it out
#ttyATH0::askfirst:/bin/ash --login

I'm not sure if disabling the console will cause any  sideeffects, but as long as I can still ssh into the Yun I feel safe

Here is a very basic sketch to run on the atmega, which reads a character and if it is one of the digits 0-8 it echos the digit value +1, otherwise it simply echos the character just read.
Code:
void setup() {
  Serial1.begin(9600);
}

void loop() {
  char c;

  while (Serial1.available() > 0) {
    c=Serial1.read();
    if(c>='0' && c<'9')
      c++;
    Serial1.print(c);
   }
}
The I wrote the most basic python code to do some IO over serial: It opens the serial given on the first commandline argument and then sends the first 5 characters from the second argument. Then it reads 5 bytes from the serial and closes it.
Code:
#File st.py run like "python st.py /dev/ttyATH0 '123abc'
import serial
import sys

s=serial.Serial(sys.argv[1],9600,timeout=1)
data =sys.argv[2]
s.write(data[0:5])
result=s.read(5)
print result
s.close()

This is what I get, seems to work fine
Code:
root@YunYun:/mnt/sda1/python# python st.py /dev/ttyATH0 'ab3deohg'
ab4de
root@YunYun:/mnt/sda1/python#

Reference to PySerial : http://pyserial.sourceforge.net
19  Products / Arduino Yún / Re: SD card will not mount on: October 05, 2013, 09:27:59 am
Have you found a fix for this yet?

I've only had my Yun a few days and so far it has not once mounted my 2GB SD card.
If i SSH into the Yun i can see it as /dev/sda, and in the Yun web interface under mount points it is available if i want to create a new mount point.
The /mnt folder is empty.
Have a look at the system log when you insert the SD-card.

Start or reboot the Yun without the Sd-card.
Open a shell (ssh) on the Yun.
Have a look at the system log
Code:
root@Arduino:~# dmesg -c
You will see a lot of messages from booting the Yun.
The -c options clears all the current messages.
Now plug you SD card in and run dmesg again. On my yYun it looks like this
Code:
root@Arduino:~# dmesg
[  405.810000] sd 0:0:0:0: [sda] 15564800 512-byte logical blocks: (7.96 GB/7.42 GiB)
[  405.900000] sd 0:0:0:0: [sda] No Caching mode page present
[  405.900000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  405.900000] sd 0:0:0:0: [sda] No Caching mode page present
[  405.910000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  405.990000]  sda: sda1
root@Arduino:~# ls -all /mnt/
drwxr-xr-x    1 root     root             0 Oct  5 12:17 .
drwxr-xr-x    1 root     root             0 Aug  8 21:48 ..
lrwxrwxrwx    1 root     root             9 Oct  5 12:17 sd -> /mnt/sda1
drwxr-xr-x    3 root     root         32768 Jan  1  1970 sda1
There is no need to create the mount dir for the SD manually.

BTW. I bought a SONY SD-card labed  SR8UY 40MBit/s. I remember reading some blog posts about the Raspberry PI not accepting certain SD-Cards
20  Products / Arduino Yún / Re: compile new packegs for linino on: October 02, 2013, 01:14:40 am
AFAIK libusb is already installed on the Yun. There is no need to compile it yourself.

Check with
Code:
root@Arduino:~# opkg list

There should be 2 packages in the list that gets printed
Code:
libusb-1.0 - 1.0.9-1
libusb-compat - 0.1.4-1


 

21  Products / Arduino Yún / Re: WebSocket on: September 26, 2013, 09:58:54 am
I have seen that, but i would like another alternative since i already a websocket server integrated with an app to control the arduino.
You have an app (Android? IOs???) with a Websocket server? Are you looking for a Websocket client then?
22  Products / Arduino Yún / Playground page for the Yun on: September 26, 2013, 05:23:06 am
I thought it might be a good idea to create a page for the Yun on the arduino playground wiki.
The Yun is just out for 2½ weeks and there are 400+ posts on the forum.

I already had to search for the Power consumption and the Build chain topics, so I thought, why not keep a permanent reference to these things on the playground?

The page is at:
http://playground.arduino.cc//Hardware/Yun

If you think a specific topic is of general interest and is not covered by the official documentation, feel free to add a section to the wiki-page.


 

 

23  Products / Arduino Yún / Re: Creating end-product from Yun on: September 25, 2013, 08:55:53 am
AFAIK, Dragino ms14 (www.dragino.com) use the same atheros chip as Yun and they have ported the Arudino Yun to run in their device. The device has a slot which has the SPI and UART interface. So you can develop a atmel board to it to make it a customized YUN end-point product.

For end users they charge 45$ plus 22$ shipping the board to Germany(US even more expensive).
On arrival the German customs will charge an extra 19% import taxes.
So you would end up spending 80$ for a board without the extra atmega already connected.
Does not sound like a bargain to me.




24  Products / Arduino Yún / Re: Software reboot doesn't work - and so watchdog neither on: September 23, 2013, 05:39:28 am
My Yun does reboot without any problems when i run  reboot from the Serial Terminal http://arduino.cc/en/Tutorial/YunSerialTerminal
25  Products / Arduino Yún / Re: Configurating the Yun as Client on: September 18, 2013, 02:03:01 pm
Hi,
did you read this section of the getting started guide?
http://arduino.cc/en/Guide/ArduinoYun#toc13

26  Products / Arduino Yún / Re: Is the Arduino Yun still Open Hardware? on: September 13, 2013, 03:53:50 am
The only "Hornet" I know of is not a "chip" but an AR9331-based router from ALFA Network:
http://wiki.openwrt.org/toh/alfa.network/hornet-ub
.....
So, what is exactly under the shield?

The schematic seems fairly complete to me http://arduino.cc/en/uploads/Main/arduino-Yun-schematic.pdf
The RAM for instance is on the last page of the pdf ...

27  Development / Other Software Development / Re: Bug reports about Arduino core + libraries to ... ? on: October 29, 2011, 06:36:04 am
Hi, bug reports for the arduino core and internal libraries go to
http://code.google.com/p/arduino/issues/list

The code itself is at
https://github.com/arduino/Arduino

(I really don't know why code and issues list are kept in two different places...)

Eberhard
28  Forum 2005-2010 (read only) / Forum / Re: Linux forum on: February 18, 2010, 09:00:34 am
Hi,
I think there are maybe 2-3 questions a week that can be said to be truly linux-specific.  
The rest is :
"I'm on <insert OS-flavour here> and the Hardware doesn't work / IDE doesn't work."
Nothing is gained if those people simply post any question into a forum because it deals witrh their OS.  
The only change I would really appreciate is a sticky topic that says :
"Please tell us what operation system are you on, when posting a question."
Because that is very often the first reply to  a new topic.

Eberhard
29  Forum 2005-2010 (read only) / Troubleshooting / Re: No ttyUSB0 in arduino IDE Ubuntu on: May 25, 2010, 01:47:39 pm
This is what is causing the trouble. But I don't really know why this is happening.

On my Ubuntu 10.04 the librxtx-java library does not create any lock files at all (with or without arduino board).

Some shots in the dark:
Remove the package librxtx-java and do a fresh install with a reboot inbetween

Try running arduino as root (sudo arduino) just to test if it makes any difference.

Are you on 32bit or 64bit ubuntu?

Eberhard
30  Forum 2005-2010 (read only) / Troubleshooting / Re: No ttyUSB0 in arduino IDE Ubuntu on: May 25, 2010, 09:56:02 am
I don't know what else could be wrong.

You havn't posted the startup messages of the IDE yet.

Eberhard
Pages: 1 [2] 3 4 ... 60