phil95
Posts: 141
Joined: Wed Sep 12, 2012 8:10 am
Location: Paris

Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 9:57 am

Hello,
I want to mount the same sd card in 256 or 512 Mb RPI.
But if the RPI board is 512 Mb, I want access to the 512 Mbytes.
System files are 256 Mb files.
I want to detect in my software if the board has 256 or 512 Mbytes.
In a 256 Mb board, I can use 8000 ... 0BFFFFFF RAM
In a 512 Mb board, I can use 8000 ... 0BFFFFFF and 10000000 ... 1FFFFFFF RAM
I have tested the two configurations, they are working.
System files are always in the 0C000000 ... 0FFFFFFF area.
But the detection is not working:
- If I use MailBox primitives, system says 256 Mbytes in the two cases
- If I use my own memory test, detection is good, but it seems that
"something" is broken in the chip if only 256 Mbytes in the board and
board crash after a long time.
Maybe cache problems.
Any idea ?
(Sorry for my poor english ...)
Philippe

Gaetan
Posts: 17
Joined: Fri Oct 26, 2012 10:19 am
Location: Lieusaint (77, France)

Re: Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 10:25 am

Hi Philippe,

try :

Code: Select all

cat /proc/cpuinfo |grep "Revision"
At home with my 512 Mo RAM model b, I've got the result :

Code: Select all

Revision        : 000f
15 (0x000f) belongs to 512 Mo RAM model, see below.

Model and revision .......................................................... Code(s)
Model B Revision 1.0 ......................................................... 2
Model B Revision 1.0 + ECN0001 (no fuses, D14 removed) .............. 3
Model B Revision 2.0 ......................................................... 4, 5, 6
Model B Revision 2.0 (512 MB) ............................................ 13, 14, 15

phil95
Posts: 141
Joined: Wed Sep 12, 2012 8:10 am
Location: Paris

Re: Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 11:13 am

@gaetan
Many thanks for your response;
I'm in bare metal mode, then no LINUX and no cat...
I have 3 RPIs:
1 RPI B 256 BoardRevision=2
1 RPI B 512 BoardRevision=5
1 RPI B 512 BoardRevision=2 (That board is effectively a 512 Mbytes board (K4P4G324EB))
Any other suggestion ?
Philippe

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 11:18 am

from Dom
http://www.raspberrypi.org/phpBB3/viewt ... 57#p281039
but it does not answer your question
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 12:38 pm

http://www.raspberrypi.org/phpBB3/viewt ... 24&t=33052

Executive Summary: Update your firmware

phil95
Posts: 141
Joined: Wed Sep 12, 2012 8:10 am
Location: Paris

Re: Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 1:50 pm

Many thanks,
with the last firmware, detection is correct.
But it is very strange that the hardware version is coded by software and for the same board
can change with the software version ...
Problem solved
Philippe
rurwin wrote:http://www.raspberrypi.org/phpBB3/viewt ... 24&t=33052

Executive Summary: Update your firmware

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 10:14 pm

I am not too sure it's is as simple as that :cry: .
The ram is shared between cpu and arm, from my test this is not linear, but theres holes all over the place.
Example: When i was working on a wav player for my OS, i loaded a program plus wav file to 20MB which was 31.4 MB in size.
It would play half the wav and then start at the beginning, i track it down to half way in to the wav, by just reading that address, it would restart the PI.
But it was so fast that it seemed like it just started from the beginning.
I test many location and only above 150MB was it safe to use, in such a big chunk.
This was on a 256 ver of the pi.

I do not no why writing to that address did not restart the pi :?
Batteries not included, Some assembly required.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Detection 256 or 512 Mb RPI

Tue Feb 12, 2013 10:56 pm

phil95 wrote:But it is very strange that the hardware version is coded by software and for the same board
Not so strange; the firmware has to know about the board before it can determine the revision. All it means is that there is no hardware register with that number in it.

phil95
Posts: 141
Joined: Wed Sep 12, 2012 8:10 am
Location: Paris

Re: Detection 256 or 512 Mb RPI

Wed Feb 13, 2013 8:40 am

@rurwin:
I agree with you. My remark was only that the same board
has differents BoardRevision following the firmware version.
Anyway, many thanks for your help.

@DexOS:
Yes, I confirm, with firmware 256 on a 512 board, it seems possible to
access to RAM between 0x10000000 and 0x1fffffff, but someting is then
corrupted in the range 0x00000000 to 0xffffffff.
Anyway, with the last firmware memory size received by the mailbox system
is correct and my problem is solved.
Many thanks

Philippe

mrvn
Posts: 58
Joined: Wed Jan 09, 2013 6:50 pm

Re: Detection 256 or 512 Mb RPI

Thu Feb 21, 2013 11:38 am

The RPi follows the ARM linux boot protocol. Which means that on start the registers contain the following:
  • R0 = 0
  • R1 = RPi magic
  • R2 = address of ATAGs
The ATAGs (google for it) contain a block for the memory size and one for the boot command line, which also includes information on the memory size. I just use the memory tag.

MfG
Goswin

Return to “Bare metal, Assembly language”