RetroBSD

2.11BSD operating system for microcontrollers
It is currently Tue Jan 25, 2022 1:19 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Wed Dec 28, 2011 11:20 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Hi, the Swapdisk v1.0 did max 2MB (x8, x16) as I lacked the free cpld pins for higher addresses. After newest remake the Swapdisk v1.1 now loads base address as six nibbles (6x4bits) and that does free 4 pins on the cpld. I am using former Data7 as the new ADR21, so now I can address full 4MByte space of the CY62177 in 8bit mode. Now we can address up to 32MByte of swap :). The mod requires to cut one single trace and to add a piece of wire.

2.11 BSD Unix for PIC32, revision #412:
Compiled 2011-12-28 by pito@ubuntu:
/home/pito/RETRO/retrobsd/sys/pic32/ubw32-uart
phys mem = 128 kbytes
user mem = 96 kbytes
root dev = (0,0)
console: port UART2
sd0: port SPI2, select pin C13
sd0: type SDHC, size 4027392 kbytes, speed 13 Mbit/sec
root size = 262144 kbytes
swap dev = (1,0)
swap size = 4096 kbytes
/dev/sd0: 188 files, 185292 used, 75827 free
..
# pstat -s
5/18 swapmap entries
465 kbytes swap used, 3631 kbytes free
#

[url=http://retrobsd.org/wp-content/uploads/2011/12/mod.jpg][/url]

And when mounted as the device /u :
# mkfs /dev/sw0 4096
Size: 4096 kbytes
Inodes: 256
# fsck /dev/sw0
** /dev/sw0
File System:
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Free List
2 files, 2 used, 4077 free
# mount /dev/sw0 /u
# ls -l /u
total 1
drwxr-xr-x 2 root 1024 Dec 28 15:45 lost+found
# cd /u
# ls
lost+found
# time dd bs=1k count=3500 if=/dev/zero of=SSS
3500+0 records in
3500+0 records out
1.0 real 0.0 user 0.8 sys
# ls -l
total 3501
-rw-r----- 1 root 3584000 Dec 28 15:48 SSS
drwxr-xr-x 2 root 1024 Dec 28 15:45 lost+found
# time dd bs=1k count=3500 if=SSS of=/dev/null
3500+0 records in
3500+0 records out
1.0 real 0.0 user 0.9 sys
#

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Fri Dec 30, 2011 5:48 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Great! Probably it's too much for swap, but we could use it for /tmp as well.
--Serge

_________________
--Serge


Top
 Profile  
 
PostPosted: Fri Jan 13, 2012 6:44 am 

Joined: Fri Nov 16, 2012 12:44 pm
Posts: 34
Hi Pito,

can you show the schematics?
I am very interested to see how you connect the SRAM to the PIC32.

Zabooh


Top
 Profile  
 
PostPosted: Fri Jan 13, 2012 4:17 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Hi Zabooh, the sram is connected to pic32 via 8bit data bus only. The addresses are generated by cpld, rd wr lda signals are passed through cpld as well. So in order to connect the swapdisk to any mcu you need 11signals and GND and 3.3V VCC, thus in total 13wires. P.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Fri Jan 13, 2012 6:46 pm 

Joined: Fri Nov 16, 2012 12:44 pm
Posts: 34
Hi Pito,

for my understanding, you send the address bits in 6 nibble packages to the CPLD before you access the SRAM with PMP direct strobe signal generation?

Is it because of reducing pins of the PIC32?

That means also, you can not use DMA for background data trasnfers. You have to setup the address of every SRAM access by bit bang.

This creates a significant performance drop.

I am getting into this discussion group, because I want to make a PIC32 board with external RAM and Ethernet on my own and would like to open schematics to everyone.
And if RetroBSD would give a Network layer, this would be a perfect software solution for this board.
If size of internal RAM is the restriction of using the network layer, my proposual is to connect external as fast as possible to the PIC32. That means using the PMP with DMA. Then memory pages of 1k-2k can be easily exchanged in the background.

Another idea to reduce usage of internal RAM is to use an externla MAC/PHY chip which does Physical and Datalink Layer.
Microchip does have standalone MAC/PHY chips (ENC424J600) with 24kByte internal SRAM for IP frame buffering.
The low level drivers for this chip can be taken from the Microchip TCP Stack. Because they are free of use.
The connection can be parallel or SPI. I would prefer SPI because of much less pins. And the bandwidth isnt so important.
On the top of the low level drivers for the external MAC/PHY, every TCP Stack can be used.

What do you think?

Zabooh


Top
 Profile  
 
PostPosted: Fri Jan 13, 2012 9:36 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Zabooh, yes the newest version uses 6nibbles to load the base address. From that moment you just read and write with autoincrement. The 6 nibbles story is because the cpld has 34 user pins so the 3x 8bit loads does not allow to address 4M (adr21). So with 6x4bit load adr arrangement I got 4 cpld's pins free. You may use the current swapdisk as:
8bitx3 addr transfer:
1Mx16, 2Mx16, 2Mx8
4bitx6 addr transfer:
4Mx8, 2Mx16, 2Mx8, 1Mx16. Cpld can address max 32M.
Pls mind the 4bitx6 addr load is done only once (it takes ~400ns max) then you read/write with autoincrement through the entire sram space. The difference in loading the addr 8x3 or 6x4 is not measurable in practise. You need bitbang rd and wr of course. With 55ns sram you can get ~7MB per second (150/140ns) rd/wr.
I think the ramdisk is quite fast so one may use it for buffering of any data. There is a space even with 2MB sram in swapdisk, when you arrange the buffers from top. I think the swap in retrobsd will never ever use more than 1MB of space, so the other half can be reused somehow.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Fri Jan 13, 2012 9:57 pm 

Joined: Fri Nov 16, 2012 12:44 pm
Posts: 34
"You need bitbang rd and wr of course" means clocking the wr/rd from source code and then reading the data from the PORT register? All "by hand"?

Zabooh


Top
 Profile  
 
PostPosted: Sat Jan 14, 2012 1:14 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Have a look on swap.c in /sys/pic32/ubw32-uart/.. that is the driver for the Swapdisk v1.1. I do not know what you mean by "by hand" :) but of course everything is done from source . You toggle rd/wr and read/write the port (to get/put data).

[url=http://retrobsd.org/wp-content/uploads/2012/01/swapdisk11.jpg][/url]

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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