RetroBSD

2.11BSD operating system for microcontrollers
It is currently Fri Jul 19, 2019 8:57 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Custom RetroBSD Board
PostPosted: Tue Oct 01, 2013 8:24 pm 

Joined: Tue Oct 01, 2013 6:41 pm
Posts: 5
Hi all, I'm new to the forum and creating a project around RetroBSD. My project is a single board computer, which uses a PIC32MX795 as the main microcontroller (running retrobsd) and a second microcontroller as a serial terminal to the main PIC32 (this microcontroller will have video output and a keyboard socket). I have a few questions regarding retrobsd and my project:

1) I would like to include a Wiznet Ethernet controller in the project. I have seen the SmallC examples for the Wiznet IC and was wondering which SPI port the Wiznet IC needs connecting to (the same SPI port as the SD card?)? Which pin is used for CS?

2) The PIC32 I will be using in the project to run RetroBSD is blank (no boot loader) and I am planning on using the Bare Metal hex file from the auto build server to flash the chip. For the SD card connections to the PIC32, are any pull up / pull down resistors required on any of the SD lines? Also, if I would like to add an external SDRAM IC to the project, how must the bare metal configuration file be changed (can I just use the same configuration file from the SDRAM prototype run post?) to set up the SDRAM and use it as swap?

3) I am having trouble compiling RetroBSD on a Lubuntu 32bit machine. I seem to get a make error 2 when trying to compile. I have followed the installation guide from the wiki page, installing the tools; am I missing something? Also, when trying to create a make file for a custom board configuration using the configuration wiki page (wiki/doku.php/wiki/configuration), I get an error stating that config cannot be found (using the below line, with my retrobsd folder path and the name of my custom config file).

$ ../../../tools/configsys/config FUBARINO

4) Is it possible to have a second SD card? If so, is it connected to the same main SD card SPI port and what configurations need to be made to the bare metal configuration file in order for a second SD to work? When running retrobsd with a second SD card, what are the commands used to mount it and set it up for user file use?

Thanks in advance for any responses,
Dan


Top
 Profile  
 
PostPosted: Thu Oct 03, 2013 11:17 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Quote:
2) The PIC32 I will be using in the project to run RetroBSD is blank (no boot loader) and I am planning on using the Bare Metal hex file from the auto build server to flash the chip. For the SD card connections to the PIC32, are any pull up / pull down resistors required on any of the SD lines? Also, if I would like to add an external SDRAM IC to the project, how must the bare metal configuration file be changed (can I just use the same configuration file from the SDRAM prototype run post?) to set up the SDRAM and use it as swap?


A pullup on sdcard's chipselect is good to have.
For SDRAM wiring and config file see this topic:
viewtopic.php?f=3&t=5100#p6582
There is the schematics in the attached file somewhere.
For sdram swap and filesystem you need 100pin pic32mx version (..512L).

Quote:
I seem to get a make error 2 when trying to compile.

Any details plz?

Quote:
Also, when trying to create a make file for a custom board configuration using the configuration wiki page (wiki/doku.php/wiki/configuration), I get an error stating that config cannot be found (using the below line, with my retrobsd folder path and the name of my custom config file).

$ ../../../tools/configsys/config FUBARINO


Better you create a new folder for your board /sys/pic32/your_board, with the new config file YOURBOARD in it (and other files copied form an existing board). Then make make from top Makefile, it builds everything for you. You need to add the your_board to /sys/pic32/Makefile (see the list of board folders names there).
You need to edit Makefile.user (at very top) and select your new board.
Start small - try to create a working system with swap on sdcard only (basic setup). The retrobsd stuff to get working is not easy, so do it step by step. Do not mess with ethernet and sdram swap unless you know well what you are doing.. ;)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Fri Oct 04, 2013 3:39 pm 

Joined: Tue Oct 01, 2013 6:41 pm
Posts: 5
Thank you for your reply. I will try to sort out my compile errors with a clean install of the latest ubuntu release and I will also follow your instructions regarding my own custom board configuration file. If I get an further errors, I will post them here.

I can add in the SDRAM later, but would really like to use the Arduino Ethernet shield (or a W5100 circuit) with retrobsd. Please advise me on the SPI connections to the PIC32 used for retrobsd (same SPI port as SD card? Which pin is used for CS?).

Dan


Top
 Profile  
 
PostPosted: Sat Oct 05, 2013 9:13 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Hi Dan, for ethernet stuff do search for "ethernet" in this forum - a few users connected wiz5100 shield to the MAX32 and it worked (see the topics on it).

The Max32 uses SPI2 for sdcard and for ethernet as well, afaik.
MAX32-ETH shows (sys/pic32/max32-eth):
Code:
device sd0 port=2 cs=4

The sdcard's chipselect is pin 4 - this is board's header pin number, otherwise RC14 (double check,plz).

The W5100.c driver (you must have retrobsd dev environment installed, look for it in /src/libwiznet/ folder) shows:

Code:
#define SPI_DEVNAME         "/dev/spi2" // W5100 chip is connected to SPI2
#define SPI_KHZ             5000        // Clock speed 5 MHz
#define SPI_SELPIN          0x0404      // chipKIT board: select pin D4

Chipselect is RD4 here (double check, plz), board's pin header 10.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Oct 06, 2013 5:18 pm 

Joined: Tue Oct 01, 2013 6:41 pm
Posts: 5
Hi Pito,

Thank you for your support with all my questions. I installed a clean version of Ubuntu and successfully managed to compile retrobsd. I was also able to create and compile my own configuration file as well. The make error 2 I mentioned in my first post was due to a make g++ command not being found, fixable using:

Code:
sudo apt-get install build-essential g++


Dan


Top
 Profile  
 
PostPosted: Mon Oct 07, 2013 1:36 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Dan,

Regards 2nd SD card.

2 cards can share same leads, BUT there are TWO fatal problems !!

1. If either card gets glitched, BOTH cards must be restarted including making ALL leads
below 0.3 V. i.e.- Power MUST be removed. Hard to do with RetroBSD using the card.

2. Hot swap does NOT work (easily) without a FULL power down restart after plug-in or plug-out.

I wound up using separate leads for both cards with bit banging to the 2nd non-BSD card as well as provision to remove power when needed.

This method seems to work OK. (a year or so).

Regards large swap RAM.

A Rasp-pi or Beaglebone black makes a pretty cheap way to hook a large DRAM to the PIC for use as a swap controller.

Regards to all,

Wiz


Top
 Profile  
 
PostPosted: Tue Oct 08, 2013 2:41 pm 

Joined: Tue Oct 01, 2013 6:41 pm
Posts: 5
Hi wiz,

If I wanted to go ahead and use two SD cards on the same SPI port (the same method used in the 32MX SDRAM prototype run post), how would I set up the second SD card inside retrobsd (which commands to use etc)?

Also, regarding you method of bit banging the second SD, can you provide any further details on this?

Dan


Top
 Profile  
 
PostPosted: Tue Oct 08, 2013 6:49 pm 

Joined: Tue Oct 01, 2013 6:41 pm
Posts: 5
Hi all, I tried using two SD cards with retrobsd, but I am unable to get them both to work. I took the following steps:

1) Create a custom configuration file. I am using a duinomite mini, so I used the duinomite config file to start and changed it to the following:

Code:
#
# Duinomite and Duinomite-Mega boards
# ===================================
#
# Console on USB
# For Windows, use the driver: http://www.schmalzhaus.com/UBW32/FW/UBW32inf.zip

core pic32mx7
mapping generic
linker bootloader-maximite

device kernel cpu_khz=80000 bus_khz=80000 led=B15

device console device=ttyUSB0
device uartusb

device rdisk led=B12
device sd0 port=3 cs=D5 power=B13 mhz=13
device sd1 port=3 cs=B3 power=B13 mhz=13 # add this line

device gpio
device foreignbootloader


2) Created a make file for the new config file and then compiled retroBSD. I then flashed the unix.hex to the duinomite and then used dd to write sdcard.rd to the primary SD card (sd0).

3) I then used dd to write the user.img to the second SD card (to put the file system on the second SD).

4) I wired the second SD card holder (which is a Arduino SD card holder) to the appropriate pins (found using the duinomite schematics).

5) I booted retrobsd but I get the following:

Code:
2.11 BSD Unix for PIC32, revision Unversioned build 0:
     Compiled /home/dan/Documents/retrobsd_testing/retrobsd-current/sys/pic32/custom by directory@2013-10-08:
     dan
cpu: 795F512H 80 MHz, bus 80 MHz
oscillator: HS crystal, PLL div 1:2 mult x20
console: ttyUSB0 (5,0)
sd0: port SPI3, select pin D5
sd1: port SPI3, select pin B3
sd1: no SD/MMC card detected
sd0: type II, size 1931264 kbytes, speed 13 Mbit/sec
phys mem  = 128 kbytes
user mem  = 96 kbytes
root dev  = rd0a (0,1)
root size = 102400 kbytes
swap dev  = rd0b (0,2)
swap size = 2048 kbytes
temp0: allocated 30 blocks
/etc/rc: 4 Memory fault - core dumped
--- Unknown error in fsck
erase, kill ^U, intr ^C
#


The second SD card is not found and I get a memory fault error. I have also tried using a different SPI port for the second SD card but got the following error (or the card not found error):

Code:
sd1: card_cmd timeout, cmd=37, addr=00000000, reply=ff
sd1: card_cmd timeout, cmd=29, addr=00000000, reply=ff


Please advise on how to fix this to allow two SD cards to be used. I tried following this post http://retrobsd.org/viewtopic.php?f=3&t=2421 but it did not seem to work.

Dan


Top
 Profile  
 
PostPosted: Tue Oct 08, 2013 9:33 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Is your system running stable with a single sdcard wired and installed?

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Thu Oct 10, 2013 7:10 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Dan and all,

It has been a long time since I did my experiments.

There was/is a version of RetroBSD that did support 2 SDs from the same port.

It 2 cards were present on power up all went well. Sometimes you could remove the 2nd card and things would keep running. The cards seem to have a big cap inside so generally both cards would take a hit when the 2nd was plugged back in.

I didn't get deep enough into RetroBSD to see if I could figure out how to do a full power-down SD restart without restarting from a new power-up.

Instead I built another SD adapter for my breadboard that could turn off and ground Vcc and hooked it to regular i/o pins.

I had built a bit-banging (not using the processor's SPI feature) SD card driver and supporting one of the FAT filesystems as a part of an earlier effort so it was pretty easy to get that running. I cannot remember if I got it officially into the kernel, probably not since it was a stand alone program.

My breadboard continues to work reliably. Has a hardware watchdog timer, etc.

Hope this helps.

Wiz


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