Daily Archives: 2014-08-10

VoCore: SPI & MicroSD 8

Yesterday, just get some result from MISO but I do not know whether or not it is right result, or at least it is not random result caused by the noise.

Today, I still not sure whether or not it is right mmc driver request result, but I am sure it is not a random result.

I just test it in this way:
spidev_test -D/dev/spidev32766.1 -s4000000
spidev_test -D/dev/spidev32766.1 -s8000000
spidev_test -D/dev/spidev32766.1 -s16000000
spidev_test -D/dev/spidev32766.1 -s32000000
spidev_test -D/dev/spidev32766.1 -s64000000

4MHz ~ 32MHz are same result. 64MHz is not same as them.

root@OpenWrt:/# spidev_test -D/dev/spidev32766.1 -s32000000
spi mode: 0
bits per word: 8
max speed: 32000000 Hz (32000 KHz)

40 3F E0 00 3F FF 
FF FF FF FF FF F0 
5F FF FF FF FF FF 
FF FC 17 FF FF FF 
FF FF FF FF 05 FF 
FF FF FF FF FF FF 
C1 7F 
root@OpenWrt:/# spidev_test -D/dev/spidev32766.1 -s64000000
spi mode: 0
bits per word: 8
max speed: 60000000 Hz (60000 KHz)

20 1F F0 00 1F FF 
FF FF FF FF FF F8 
2F FF FF FF FF FF 
FF FE 0B FF FF FF 
FF FF FF FF 82 FF 
FF FF FF FF FF FF 
E0 BF 

I do not know a byte of the result, but I am sure the result is not random noise.
So I guess the TF card support up to 30MHz, it is 1/4 of system timer who is 120MHz.

The result has so many 0xFF, that might be an error result due to R3(MISO) is pulled to VCC.
So I change the hardware a little, switch R3 from pulling to VCC to pulling to GND. If the result has many 0x00 replace that 0xFF, the hardware must not right and the result is not really from TF card.

root@OpenWrt:/# spidev_test -D/dev/spidev32766.1 -s32000000
spi mode: 0
bits per word: 8
max speed: 32000000 Hz (32000 KHz)

00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 
root@OpenWrt:/# spidev_test -D/dev/spidev32766.1 -s32000000
spi mode: 0
bits per word: 8
max speed: 32000000 Hz (32000 KHz)

40 3F E0 00 3F FF 
FF FF FF FF FF F0 
5F FF FF FF FF FF 
FF FC 17 FF FF FF 
FF FF FF FF 05 FF 
FF FF FF FF FF FF 
C1 7F 
root@OpenWrt:/# 

First result, the slot of TF card is empty.
Second result, plug TF card into slot. It is same result as we pull MISO to high. I am sure now, the data is from TF card.

So, the hardware is totally fixed, just need to find a way to make the mmc-spi-slot driver work. That will take some time, have to go plan B, no time left for factory firmware.