RetroBSD

2.11BSD operating system for microcontrollers
It is currently Thu Oct 18, 2018 9:51 pm

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Olimex pinguino
PostPosted: Sat Jan 02, 2016 10:16 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi All,

Just got pinguino board. Nice.

Put file system on uSD no problem.

Trying to load Unix.hex with stock linux32/pic32prog. No go :(.

Downloaded pic32prog sources, compiled, run. Tried again. Still no go.

I am using Linux Knoppix 7.2 (32 bit) on a Dell 8200. I doubt that that matters.

Put stuff into target.c. pic32prog identifies /dev/ttyACM0 OK.

Push reset on pinguino. try: pic32prog -d /dev/ttyACM0 unix.hex

Green LED comes on for a few seconds.

Eventually pic32prog says "No target found."

It looks to me like the pinguino as supplied is expecting a different protocol. I also tried: ascii:/dev/ttyACM0 and an1388.

All no go.

It would be nice to be able upload the code on the PIC32 and see what it is.

Also, pic32prog should report the characters it sends and receives when some debug flag is set.

Has anyone else gotten pinguino to work?

Lots of fun :).

Wiz


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Sun Jan 03, 2016 9:27 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Normally you have to push a buttonX, while the buttonX is hold down, you push the reset button. The LedY starts to blink. Then you start pic32prog.
Also you have to flash the bootloader which works with pic32prog first.
This is how the bootloader starts.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Sun Jan 03, 2016 9:56 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
The board comes preprogrammed with bootloader _and_ the kernel. All you need is to insert SD card plug in USB cable, connect to /dev/ttyACM0 with minicom and press <Enter>. It will start RetroBSD.

In case you want to reprogram the kernel, there is one minor issue. The preinstalled bootloader uses wrong pin for the BUT button. Usually, to enter boot mode, one needs to hold PRG button and press RST button. This method does not work here. I'm not sure which button it tries to use. I would propose to try RC13 (as on Maximite) or RD8 (as on Duinomite). Just connect it to ground by a jumper wire, while pressing RST. After that, the board should switch to the boot mode and start communicating with pic32prog.

You can find correct bootloader here: https://raw.githubusercontent.com/sergev/pic32-usb-bootloader/master/pinguino-micro/bootloader.hex - in case you have pickit2 and a miniICSP connector to reflash the bootloader.


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Sun Jan 03, 2016 6:31 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Serge and all,

Well, I feel a more than a little stupid :).

Works like a champ. I got a few funny chars getting miniterm started, but otherwise glitch free :).

Stuff compiles, examples work. Really FANTASTIC !!

Some curious files in /etc (phones) and (remote).

I think we might consider an insert in the Pinguino-RetroBSD package. "Do this first." for folks like me who assume things are going to be difficult.

I downloaded retrobsd-pinguino-micro-2015-12-30.zip and took sdcard.img from there. Did: dd bs=32k if=sdcard.img of=/dev/sdb [sd card to be programmed]. Kinda a shame to turn a 16GB card into 100Mb. Oh well it works :).

Gotta try sz-rz to see if I can upload and download from the 'main' box to save and restore stuff.

I wonder if baudrate is relevant at all over USB serial? It seems to me like it should not be?

Lots of questions....

The hardware works :) :) :).

The software works :) :) :).

Now for some 'real' application :).

Lots of fun :).

Wiz


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Sun Jan 03, 2016 6:52 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Serge,

Using miniterm -s on /dev/ttyACM0 at baudrate 4800 seems to work without a hitch and at very high speed.

So miniterm baudrate does not seem to matter.

Just set it to 300 baud.... Works the same.... Very high speed.

From RetroBSD terminal: sz filename work OK :)

But from host -> retro seems to "Got ERROR". Sounds like the speed related problem of a while ago? Keeps retrying but keeps getting errors. Ctrl-C does terminate transfer attempt :).

So perhaps there is another way to send files from host to retro?

Lots of fun :).

Wiz


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Sun Jan 03, 2016 7:07 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi All,

Tried cat filename >/dev/ttyACM0 with emg filename running on retro. No go (many missing characters)

Also tried cp filename /dev/ttyACM0. Same result.

Tried with hardware/software flow control on and off. Same result.

So it looks like flow control is not implemented correctly. Perhaps missing chars are what is causing grief for rz?

There is probably some other way I haven't thought of yet?

Lots of fun.

Wiz


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Sun Jan 03, 2016 7:14 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Serge,

I bet if I had a real 4800 baud serial terminal things would just work. [ I don't have rz problems on my systems at 4800 baud.]

Can I get a 4800 baud serial terminal working on pinguino on some pins? I seem to recall reading something about it, but does it work on pinguino? What is the correct syntax for starting it? What pins or which uart(s)?

Lots of fun.

Wiz


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Sun Jan 03, 2016 10:54 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Serge and all,

So I tried editing /etc/ttys.

I enabled tty1.

System now crashes on startup :(. Oh well.

The only way to recover seems to be to reload the SD. I tried to stop the startup but when I try to run emg to edit /etc/ttys it complains and the system crashes.

Hmmmm....

Lots of fun.

Wiz


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Mon Jan 04, 2016 1:45 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
Hi Wiz,

Files /etc/phones and /etc/remote are mostly of historical value. These were used for UUCP connections in early 80s. A funny map of Usenet network from 1983 is available here: http://olduse.net/blog/current_usenet_map/. Most names from /etc/phones are present on this map.

Technically, it' still possible to use this feature with /bin/tip or /bin/uucp, but I'm not sure it makes any sense these days.

It would be nice to create some tutorial for this board, like "RetroBSD Getting Started", but I'm afraid I cannot help here. I just don't have this view, you know. I cannot look at it by eyes of newbie. I've been involved into the project for so long, so most aspects seem trivial for me... It's hard to describe things when you don't feel which topic is difficult and which is not.

The baud rate in case of virtual serial-over-USB port is essentially ignored. You can use any value with the same result. I don't know what's wrong with sz from host to retro - I never tried. May be it's better to ask Pito for his experience.

It's possible to transfer files to/from RetroBSD via SD card. You can mount the Retro filesystem on Linux, then copy files/directories using standard Linux tools, then unmount and plug it back into Olimex board. First, you have to build and install the fsutil program:
Code:
cd retrobsd/tools/fsutil
make
sudo make install
sudo chgrp disk /usr/local/bin/fsutil
sudo chmod g+s /usr/local/bin/fsutil

This will install fsutil on your host computer as /usr/local/bin/fsutil, with set-group-id bit and group "disk". By default, external USB disks are accessible only by "disk" group. The g+s bit allows ordinary users to call fsutil directly without sudo.

Now it's possible to mount the SD card on Linux. For example, on my Dell notebook with native SD slot this looks like:
Code:
$ mkdir ~/sdcard
$ fsutil --mount --partition=1 /dev/mmcblk0 ~/sdcard
Filesystem mounted as /home/vak/sdcard
Press ^C to unmount

After that, the contents of RetroBSD filesystem is available as "sdcard" subdirectory in your home directory. Launch another terminal window or tab and try:
Code:
ls -l ~/sdcard
total 17
drwxrwxr-x 2 root root 3072 дек.  18 13:10 bin
drwxrwxr-x 2 root root 2048 дек.  18 13:10 dev
drwxrwxr-x 2 root root 1024 дек.  20 15:42 etc
drwxrwxr-x 3 root root 1024 дек.  18 13:10 games
drwxrwxr-x 7 root root 1024 дек.  18 13:10 include
drwxrwxr-x 2 root root 1024 дек.  18 13:10 lib
drwxrwxr-x 2 root root 1024 дек.  18 13:10 libexec
drwxrwxrwx 2 root root 1024 дек.  18 13:10 lost+found
drwxrwxr-x 2 root root 1024 дек.  20 13:46 root
drwxrwxr-x 2 root root 1024 дек.  18 13:10 sbin
drwxrwxr-x 8 root root 1024 дек.  18 13:10 share
drwxrwxr-x 2 root root 1024 дек.  20 15:42 tmp
drwxrwxr-x 2 root root 1024 дек.  18 13:10 u
drwxrwxr-x 6 root root 1024 дек.  18 13:10 var

You can freely copy files, create/delete directories, symlinks and do whatever you want. To unmount, press ^C in the terminal window where the fsutil mount is called.


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Mon Jan 04, 2016 2:01 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
As for additional serial ports, it's possible, but unfortunately, the preinstalled kernel has no UARTs enabled. I've modified the configuration for pinguino-micro lately, adding two ports. See retrobsd/sys/pic32/pinguino-micro/Config:
Code:
# Serial UART ports
device          uart1                       # Pins 4, 5 at CON2 connector
device          uart2                       # Pins 3, 4 at UEXT connector

So you will have to reflash the kernel somehow (use latest pinguino-micro binary from RetroBSD autobuild server.

With updated kernel, you will have two devices: /dev/tty0 and /dev/tty1. It's possible to enable them in /etc/ttys file and have two more getty logins:
Code:
# ps alx
  F S   UID   PID  PPID CPU PRI NICE  ADDR  SZ WCHAN    TTY  TIME COMMAND
  3 S     0     0     0  47   0   0 0x6800   3 runout   ?    0:01 swapper
200 S     0     1     0   0  30   0   0xd1  36 proc     ?    0:00 init -
200 S     0    10     1   2  40   0    0xd   7 u        ?    0:00 update
200 S     0    12     1   0  26   0    0xa  55 selwait  ?    0:00 cron
200 S     0    14     1  24  28   0   0xd7  38 proc     0    0:00  (-)
200 S     0    15     1  14  28   0   0xd4  38 proc     1    0:00  (-)
200 S     0    13     1  16  30   0  0x106  39 proc     USB  0:00 -sh
  1 R     0    19    13  14  50   0 0x7400  43          USB  0:00 ps alx

Lines with PID=14 and 15 here are two additional /libexec/getty processes at serial ports /dev/tty0 (which is UART1) and /dev/tty1 (UART2).


Top
 Profile  
 
 Post subject: Re: Olimex pinguino
PostPosted: Mon Jan 04, 2016 2:27 am 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Serge,

Thanks :).

I can verify U2TX works OK by doing portio -o f5 and then -s -c :).

Works great :).

I tried /libexec/getty tty1 tty1 xterm which faults :). But no apparent harm done. Didn't think to look for uart1 and 2.

So pins seem hooked up, etc. :).

New kernel available - THANKS!.... Yup gotta figure out a way to load it. At least I know what the problem and solution are now :).

Thanks also for how to see files from Linux. Tried it but no go without the right drivers. Another thing to get running.

Some way to pass data up and down from the running system makes the most sense to me. The sz-rz is what I have been using at 4800 baud. So I expect once I have a new kernel loaded it will just work. I suppose the USB flow control 'should' really be fixed.

I think adding the ability to pass running boot image and unix image up to host makes a lot of sense to me [to verify it hasn't changed and if it has changed, what was changed].

RetroBSD 'should' be able to upgrade itself [using drivers in RAM] or in the boot flash IIRC. Maybe it's time to get that working?

It would make an easy way to upgrade both boot and unix.hex from files the SD card. As the author of an old math book says: "The proof is left to the serious student as an excersize!"

Thanks for your quick answer :).

Lots of fun.

Wiz


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission