Hi Jamey,
On 09/03/2015 04:40 PM, Jamey Sharp wrote:
On Thu, Sep 3, 2015 at 11:21 AM, Humberto López León <humberto@...210...> wrote:
Apparently the test fails to make the comparison between the read and written. Personally I think the problem is in writing, using the FAT32 port could read from a file that was on the SD card without problems, but the test failed when trying to create a file.
Anyone have any suggestions of what may be affecting writing?
SD cards can have a physical write-protect switch on them, right? Have you checked if your card is write-protected?
I checked the physical write-protect switch and it is not activated. Also, I tried to write to the SD card with the "dd" command and it worked properly.
Based on the example "repos/os/src/drivers/sd_card/OMAP4/bench" I implemented an application to read from the SD Card and one for writing it. Both applications create an instance of the SDHCI driver and use the functions read and write respectively.
To check the read operation, I used the tool dd (Linux command: echo "MY TEXT" | sudo dd of=/dev/sdb bs=512 count=1) to write to the SD card the string "MY TEXT" which was printed correctly using the application that I implemented for reading from the SD card. Thus I checked that the reading operation in SDHCI protocol, implemented for Raspberry Pi, work properly in the ODROID-X2 (Exynos4412).
This is the serial output for read aplication after writing "MY TEXT" in the SD card with the tool dd (Linux command):
Genode 15.05-176-g7df72d4 <local changes> int main(): --- create local services --- int main(): --- start init --- int main(): transferred 2027 MB to init int main(): --- init created, waiting for exit condition --- [init] Could not open ROM session for module "ld.lib.so" [init -> platform_drv] --- Odroid-x2 platform driver --- [init -> sd_card_read] --- Exynos4 SD card read test --- [init -> platform_drv] Dentro del constructor CMU [init -> platform_drv] Changing CPU frequency to 1400000000 [init -> platform_drv] End of Changing CPU frequency to 1400000000 [init -> platform_drv] Saliendo del constructor CMU [init -> platform_drv] Entrando del constructor PMU [init -> platform_drv] Saliendo del constructor PMU [init -> platform_drv] --- Odroid-x2 platform driver. Done --- [init -> sd_card_read] CID: 0x744a4553 0x44432020 0x1033005b 0x8700e100 [init -> sd_card_read] RCA: 0xb368 [init -> sd_card_read] SD card detected [init -> sd_card_read] capacity: 7695 MiB [init -> sd_card_read] [init -> sd_card_read] -- Reading from SD card -- [init -> sd_card_read] [init -> sd_card_read] Card content: [init -> sd_card_read] Element 0: M [init -> sd_card_read] Element 1: Y [init -> sd_card_read] Element 2: [init -> sd_card_read] Element 3: T [init -> sd_card_read] Element 4: E [init -> sd_card_read] Element 5: X [init -> sd_card_read] Element 6: T [init -> sd_card_read] [init -> sd_card_read] --- Exynos4 SD card Read Test finished ---
To check the write operation, I used the tool dd (Linux command: sudo dd if=/dev/sdb bs=512 count=1 | od -a) to read the contents of the SD card. This command starts reading from the beginning of the SD card and the application that I implemented to write also writes from the beginning. In this case, the dd command output does not match what the application should write. Thus I find that the driver does not perform the write operation correctly.
This is the serial output for write aplication :
Genode 15.05-176-g7df72d4 <local changes> int main(): --- create local services --- int main(): --- start init --- int main(): transferred 2027 MB to init int main(): --- init created, waiting for exit condition --- [init] Could not open ROM session for module "ld.lib.so" [init -> platform_drv] --- Odroid-x2 platform driver --- [init -> sd_card_write] --- Exynos4 SD card write test --- [init -> platform_drv] Dentro del constructor CMU [init -> platform_drv] Changing CPU frequency to 1400000000 [init -> platform_drv] End of Changing CPU frequency to 1400000000 [init -> platform_drv] Saliendo del constructor CMU [init -> platform_drv] Entrando del constructor PMU [init -> platform_drv] Saliendo del constructor PMU [init -> platform_drv] --- Odroid-x2 platform driver. Done --- [init -> sd_card_write] CID: 0x744a4553 0x44432020 0x1033005b 0x8700e100 [init -> sd_card_write] RCA: 0xb368 [init -> sd_card_write] SD card detected [init -> sd_card_write] capacity: 7695 MiB [init -> sd_card_write] [init -> sd_card_write] -- Writing to SD card -- [init -> sd_card_write] [init -> sd_card_write] It was written in the SD card: [init -> sd_card_write] Elements to write 0: a [init -> sd_card_write] Elements to write 1: b [init -> sd_card_write] Elements to write 2: c [init -> sd_card_write] Elements to write 3: d [init -> sd_card_write] [init -> sd_card_write] --- Exynos4 SD card Read Test finished ---
This is the result of the tool dd (Linux command) to read from the SD card after running the write application:
0000000 V f v D nul nul nul nul nul nul nul nul nul nul nul nul
This is the serial output for read aplication after running the write application:
Genode 15.05-176-g7df72d4 <local changes> int main(): --- create local services --- int main(): --- start init --- int main(): transferred 2027 MB to init int main(): --- init created, waiting for exit condition --- [init] Could not open ROM session for module "ld.lib.so" [init -> platform_drv] --- Odroid-x2 platform driver --- [init -> sd_card_read] --- Exynos4 SD card read test --- [init -> platform_drv] Dentro del constructor CMU [init -> platform_drv] Changing CPU frequency to 1400000000 [init -> platform_drv] End of Changing CPU frequency to 1400000000 [init -> platform_drv] Saliendo del constructor CMU [init -> platform_drv] Entrando del constructor PMU [init -> platform_drv] Saliendo del constructor PMU [init -> platform_drv] --- Odroid-x2 platform driver. Done --- [init -> sd_card_read] CID: 0x744a4553 0x44432020 0x1033005b 0x8700e100 [init -> sd_card_read] RCA: 0xb368 [init -> sd_card_read] SD card detected [init -> sd_card_read] capacity: 7695 MiB [init -> sd_card_read] [init -> sd_card_read] -- Reading from SD card -- [init -> sd_card_read] [init -> sd_card_read] It was written in the SD card: [init -> sd_card_read] Elements to write 0: V [init -> sd_card_read] Elements to write 1: f [init -> sd_card_read] Elements to write 2: v [init -> sd_card_read] Elements to write 3: D [init -> sd_card_read] [init -> sd_card_read] --- Exynos4 SD card Read Test finished ---
Any recommendation?
Where I could study in depth the SDHCI controller specification?
The SDHCI controller in Genode was originally implemented for Raspberry Pi board, but I have not found any section of code that is platform-dependent, except the memory map. In addition to the memory map, I need to change something in the implementation of SDHCI?
Regards, Humberto.