ulink
Posts: 7
Joined: Mon Jan 23, 2017 11:48 am

SD on CM3 module

Mon Jan 23, 2017 11:52 am

Is it possible to apply an (external) SD card via SODIMM pins to a CM3 module (with internal 4GB eMMC, I do NOT mean the CM3 Lite) ?
ULink

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: SD on CM3 module

Mon Jan 23, 2017 1:34 pm

Do you mean add an SD card socket to a CM3 which boots from the onboard flash?

If so, then yes. You can have the 2nd SDIO peripheral at GPIO 22-27 or 34-39.

ulink
Posts: 7
Joined: Mon Jan 23, 2017 11:48 am

Re: SD on CM3 module

Mon Jan 23, 2017 1:46 pm

gregeric wrote:Do you mean add an SD card socket to a CM3 which boots from the onboard flash?
If so, then yes. You can have the 2nd SDIO peripheral at GPIO 22-27 or 34-39.
Yes, I meant a additional "second" (external) SD card for some data.
It's ok if the CM3 can only boot from internal eMMC if the eMMC is present (it SOULD do so).

Thanks!
ULink

ulink
Posts: 7
Joined: Mon Jan 23, 2017 11:48 am

Re: SD on CM3 module

Mon Jan 23, 2017 6:15 pm

Tested a Compute Module 3 (it includes a 4GB eMMC) on a Compute Module 3 IO Board V3.0 recently. An additional second SD-card on the board seems NOT recognized. At least, nothing is shown using dmesg and fdisk.

Maybe this is by intention, on the CM3 IO board there is printed: "SD CARD ONLY FOR MODULES WITHOUT ON-BOARD FLASH".

So maybe I have to wire my own SD socket to GPIO pins 22-27 or 34-39 (as you suggested).
ULink

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2220
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SD on CM3 module

Mon Jan 23, 2017 6:48 pm

That's correct. The SD and eMMC sockets both use the same set of GPIOs, so only one can be used at any time.

marco.dittamondi
Posts: 12
Joined: Fri Jan 27, 2017 9:31 am

Re: SD on CM3 module

Thu Feb 02, 2017 9:47 am

Hi all,
i want to use Raspberry Compute Module 3 (CM3) for an industrial project. The problem is that 4GB of emmc (connected to SD0 broadcom private bus) is not enough. I want to connect an additional SD card (8GB) throught the second SD interface SD1 (GPIO from 22 to 27 in ALT3). The problem is that with this connection and with the default Raspbian Lite jessy (kernel 4.4) the connected sdcard is not recognized. I tried to set the gpio alternate (ALT3) function with cli raspi-gpio but no results. What is the problem?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2220
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SD on CM3 module

Thu Feb 02, 2017 10:35 am

Add the following to config.txt:

Code: Select all

dtoverlay=sdio,poll_once=off
It will load the bcm2835-mmc driver (the one used for WiFi on Pi3) and select the Alt3 function on pins 22-27. Without "poll_once=off", you won't be able to reinsert the SD card and detection might be less reliable.

marco.dittamondi
Posts: 12
Joined: Fri Jan 27, 2017 9:31 am

Re: SD on CM3 module

Thu Feb 02, 2017 12:34 pm

Tnx, i add this and the sd card is detected now and i can mount it like any other storage.
I have another big problem: the sd card works only if i set bus_width=1 and not with the default value 4. Note that the electrical net is ok. The error in on boot and is equal to this: https://github.com/raspberrypi/linux/issues/1205
I don't understand what is the problem

creeswarlowe
Posts: 9
Joined: Mon Feb 06, 2017 2:27 am

Re: SD on CM3 module

Sat Feb 11, 2017 5:07 am

I am also doing exactly what this thread is discussing - I have a CM3 (not CM3L) with GPIO22-27 hooked up to a (second) SD card interface. I've verified with 'gpio readall' that GPIO 22-27 are in ALT3 mode after adding 'dtoverlay=sdio,poll_once=off' to /boot/config.txt.

After a reboot, I see this repeatedly about once a second in 'dmesg':

Code: Select all

[  104.230498] mmc1: error -110 whilst initialising SD card
[  105.308665] mmc1: host does not support reading read-only switch, assuming write-enable
[  105.312484] mmc1: error -110 whilst initialising SD card
[  105.400705] mmc1: host does not support reading read-only switch, assuming write-enable
[  105.404866] mmc1: error -110 whilst initialising SD card
[  105.494869] mmc1: host does not support reading read-only switch, assuming write-enable
[  105.499814] mmc1: error -110 whilst initialising SD card
[  105.613142] mmc1: host does not support reading read-only switch, assuming write-enable
[  105.620159] mmc1: error -110 whilst initialising SD card
If I put a bus_width of 1 at the end of the dtoverlay ('dtoverlay=sdio,poll_once=off,bus_width=1'), then it gets a little bit further:

Code: Select all

[   50.272475] mmc1: new high speed SDHC card at address aaaa
[   50.272950] mmcblk1: mmc1:aaaa SS04G 3.69 GiB
[   50.274095] mmcblk1: error -110 sending status command, retrying
[   50.274128] mmcblk1: error -110 sending status command, retrying
[   50.274155] mmcblk1: error -110 sending status command, aborting
[   50.274298]  mmcblk1: unable to read partition table
[   50.274618] mmc1: card aaaa removed
[   50.369443] mmc1: host does not support reading read-only switch, assuming write-enable
[   50.372756] mmc1: new high speed SDHC card at address aaaa
[   50.373209] mmcblk1: mmc1:aaaa SS04G 3.69 GiB
[   50.374363] mmcblk1: error -110 sending status command, retrying
[   50.374398] mmcblk1: error -110 sending status command, retrying
[   50.374420] mmcblk1: error -110 sending status command, aborting
[   50.374581]  mmcblk1: unable to read partition table
[   50.374944] mmc1: card aaaa removed
I've tried a couple of different SD cards as well. It seems like a clue is the 'read-only' switch...which occurs in both instances. It looks like I'm close, as it's trying to mount 'mmcblk1' in both bus widths...though my system has a 4-lane bus to the SD card (DAT0-3). I've verified that I have the correct pinout many times as well.

Does the SD card have to be formatted a certain way? Is ext4 a requirement?

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1416
Joined: Sat Sep 10, 2011 11:43 am

Re: SD on CM3 module

Sat Feb 11, 2017 6:53 am

Do you have external pull ups on the SD lines?
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: SD on CM3 module

Sat Feb 11, 2017 8:59 am

If signal integrity is suspected, it might be worth lowering the SDIO high speed clock. Add "sdio_overclock=25" to the dtovderlay= line. If that works, crank it up to the next permitted value, 250/2N (N=5 gives 25MHz, lowered from the default N=3 / 41.6MHz). Series termination resistors of ~33R seem to work well to minimise ringing.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2220
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SD on CM3 module

Sat Feb 11, 2017 10:44 am

The overclock parameter can't be used to underclock. Signal integrity problems like that ought to trigger the MMC framework to lower the clock and retry.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1416
Joined: Sat Sep 10, 2011 11:43 am

Re: SD on CM3 module

Sat Feb 11, 2017 11:16 am

Phil,

Does the dtoverlay=sdio also enable the pullups?

If not then that's likely to be the problem... I doubt the issue is with speed because it is even failing to get the status command (which is all done over the SDCMD wire so width of data has no effect)

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2220
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SD on CM3 module

Sat Feb 11, 2017 11:19 am

Does the dtoverlay=sdio also enable the pullups?
Yes (0=none, 2 = up): https://github.com/raspberrypi/linux/bl ... ay.dts#L26

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: SD on CM3 module

Sat Feb 11, 2017 12:33 pm

PhilE wrote:The overclock parameter can't be used to underclock.
Is that new behaviour? I managed to convince myself here that I could underclock the SDIO bus. The ESP8089 simply wouldn't work without that change.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1416
Joined: Sat Sep 10, 2011 11:43 am

Re: SD on CM3 module

Sat Feb 11, 2017 4:43 pm

Can you attach a scope and probe the frequency of the SDCLK?
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

creeswarlowe
Posts: 9
Joined: Mon Feb 06, 2017 2:27 am

Re: SD on CM3 module

Sat Feb 11, 2017 4:48 pm

Do you have external pull ups on the SD lines?
Yes and no - I did originally (10k's as placeholders just in case) but I removed them as a test with the same result. Ditto with some ESD diodes - those two were actually the first thing I suspected.
If signal integrity is suspected, it might be worth lowering the SDIO high speed clock.
When I looked with a scope, everything looked very clean with nice rise/fall times and very minimal ringing.

I think I may have found my problem - on one unit (the one I was testing with), we had started with the 'minimum device tree' for the compute module. We've been configuring peripherals through the device tree - by the way, configuring pins 22-27 as 'sdcard' through the device tree causes the unit to be inoperable - it must be defaulting to ALT0 (aka SD0 interface), which would be the same as the on-board eMMC.

When I went back to the stock jessie-lite (without any modifications to the device tree), and simply added 'dtoverlay=sdio,poll_once=off' too /boot/config.txt, I was able to mount /dev/mmcblk1p1 successfully! This is with external pull-ups and ESD diodes (different unit now).

Now I need to figure out what needs to go back into the device tree. To those of you who are struggling with this like I was - have you been messing around with the device tree?

creeswarlowe
Posts: 9
Joined: Mon Feb 06, 2017 2:27 am

Re: SD on CM3 module

Sun Feb 12, 2017 3:45 am

gsh wrote:Can you attach a scope and probe the frequency of the SDCLK?
Yes - see my post (above) about having a stock Jessie Lite Raspberry image without any device tree modification.

Stock Jessie Lite: 41.67MHz, can mount/read/write mmcblk1p1 successfully
tek00007.png
tek00007.png (60.31 KiB) Viewed 8060 times

Modified device tree: Switches between 400kHz (first picture) and a very terribly-looking 41.74MHz (second picture)
tek00004.png
tek00004.png (57.13 KiB) Viewed 8060 times
tek00006.png
tek00006.png (22.77 KiB) Viewed 8060 times
Don't mind the ringing on the signals - I had a long ground when I re-measured.

I tried adding stuff to our device tree (which gets compiled into dt-blob.bin), but couldn't find the solution. Do you have any ideas as to what I'm missing in my device tree to get this to work (like the stock jessie-lite without modification or a dt-blob.bin file)?

senseless
Posts: 6
Joined: Fri Feb 10, 2017 4:21 pm

Re: SD on CM3 module

Thu Feb 16, 2017 1:46 pm

creeswarlowe wrote: I tried adding stuff to our device tree (which gets compiled into dt-blob.bin), but couldn't find the solution. Do you have any ideas as to what I'm missing in my device tree to get this to work (like the stock jessie-lite without modification or a dt-blob.bin file)?
I'm also having exactly the same issue as creeswarlowe. If I delete the device tree, sd is working, but with a custom one, it is not.
I think the device tree blob should not have something about the secondary sd interface in it, because the sdio overlay is configuring the GPIOs, right?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2220
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SD on CM3 module

Thu Feb 16, 2017 1:57 pm

Creating a custom DT is prone to problems if the officiall DT changes on a way that is relied on by the kernel. Overlays are safer, but they are harder to write.

If you have a DT that isn't working, stick it on pastebin, dropbox etc., post a link and I'll take a look.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2220
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SD on CM3 module

Thu Feb 16, 2017 3:11 pm

I've received a dt-blob.dts (not real Device Tree, which is what I was expecting) by a side channel, and the CM3 section is missing some key definitions. A relatively recent source can be found here (https://raw.githubusercontent.com/raspb ... t-blob.dts) - in particular the pins_cm3 section matches what I have. Compare your pins_cm3 with that and think hard about any differences.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6876
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: SD on CM3 module

Thu Feb 16, 2017 3:14 pm

PhilE wrote:I've received a dt-blob.dts (not real Device Tree, which is what I was expecting) by a side channel, and the CM3 section is missing some key definitions. A relatively recent source can be found here (https://raw.githubusercontent.com/raspb ... t-blob.dts) - in particular the pins_cm3 section matches what I have. Compare your pins_cm3 with that and think hard about any differences.
I suspect that has occurred as the camera and display example blobs in the documentation repo were incorrect.
Pull request waiting to be merged that fixes them all.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

creeswarlowe
Posts: 9
Joined: Mon Feb 06, 2017 2:27 am

Re: SD on CM3 module

Fri Feb 17, 2017 2:42 am

I started over with the recent source at https://raw.githubusercontent.com/raspb ... t-blob.dts, and built the changes on top of that (I was using the minimal compute module example before). I'm happy to report that it was successful, and that there are not any SD card problems now.

Thanks for the help and for the helpful source link!

aBUGSworstnightmare
Posts: 1350
Joined: Tue Jun 30, 2015 1:35 pm

Re: SD on CM3 module

Fri Feb 17, 2017 6:47 am

creeswarlowe wrote:I started over with the recent source at https://raw.githubusercontent.com/raspb ... t-blob.dts, and built the changes on top of that (I was using the minimal compute module example before). I'm happy to report that it was successful, and that there are not any SD card problems now.

Thanks for the help and for the helpful source link!
The link above is not working (invalid request). Are you referring to the same source as PhilE a few answers up?

Do you mind posting your .dts file here?

senseless
Posts: 6
Joined: Fri Feb 10, 2017 4:21 pm

Re: SD on CM3 module

Fri Feb 17, 2017 11:40 am

Thanks!! Really appreciating the fast responses here.
With the link provided by PhilE, it is now working also with a custom device tree for using both cameras for example.

@aBUGSworstnightmare citation destroys links in this forum, so just use the original one.

Return to “Compute Module”