[squeak-dev] SerialPort on Raspberry Pi

Herbert König herbertkoenig at gmx.net
Mon Jan 18 20:17:03 UTC 2016


Hi Jon,

it used to work exactly like this.

I have two methods from March 2015 to control a servo controller via 
RS232C. One is:
initSystem
     (self serialPortName: '/dev/ttyAMA0') ifNil: [0 halt "can't init 
serial port"].
     self getErrors
which calls:
serialPortName: aString
     "return nil if opening failed"
     ^serial openPort: aString
and in initialize I do:
initialize
     "super uses two SerialPorts, so no super initialize here"
     serial := SerialPort new.
     serial baudRate: 115200.
     serialCommand := serial.

No access to my Pi's I just copied this from a backup of the Squeak 4.5 
image with the old VM which I have on my laptop. I haven't used this 
software since last October (youngest method stamp). So maybe one of the 
raspbian updates broke it or the new VM or image need different 
incantations. I didn't use sudo but missing access rights can also cause 
problems.

Cheers,

Herbert

So maybe you try on 4.5 and the old VM.

Am 18.01.2016 um 13:50 schrieb Jon Hylands:
> You don't need a device to test it - Serial doesn't require a second 
> device if all you're doing is sending bytes.
>
> The issue I'm having is when I try and open the port - that part is 
> failing.
>
> Tim, not sure if you have Scratch set up to access the underlying 
> Squeak code, but if you do:
>
> | serialPort |
> serialPort := SerialPort new.
> serialPort baudrate: 115200.
> serialPort openPort: '/dev/ttyAMA0'.
> serialPort inspect
>
> the port instance variable in serialPort will be nil if it failed, and 
> something else if it didn't fail.
>
> Thanks,
> Jon
>
>
> On Sun, Jan 17, 2016 at 6:38 PM, tim Rowledge <tim at rowledge.org 
> <mailto:tim at rowledge.org>> wrote:
>
>
>     > On 14-01-2016, at 5:51 AM, Jon Hylands <jon at huv.com
>     <mailto:jon at huv.com>> wrote:
>     >
>     >
>     > Hi everyone,
>     >
>     > I'm trying to use the SerialPort class on my Raspberry pi 2, to
>     access the UART on the pi.
>     >
>     > I've successfully accessed the port from python, using pyserial.
>     On the pi, the port name is '/dev/ttyAMA0’.
>
>     The only thing I can offer is that Scratch finds a serial port as
>     /dev/ttyAMA0 as well, implying that on at least one Pi it finds
>     the same port that python does. I don’t think I have any devices
>     that I could even try to connect to. Any suggestions for things
>     that might be around the office?
>
>     I do faintly recall some discussions about Pi serial stuff and
>     having to use the rasp-config utility but that was a long time ago
>     and I don’t seem to have any emails referring to it.
>
>
>     tim
>     --
>     tim Rowledge; tim at rowledge.org <mailto:tim at rowledge.org>;
>     http://www.rowledge.org/tim
>     Strange OpCodes: EOS: Erase Operating System
>
>
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160118/4299454c/attachment.htm


More information about the Squeak-dev mailing list