zirunhong I try probe the CLK line on my scope and wired thing happens. The file system is not working (it can’t mount the SD card, read or write), when I remove the probe, it works as normal. When probing other line, it works perfect as well. I thought it might because of my scope goes wrong but I try with another scope and still the same. Still debugging…

There’s also a mention of changing the drive strength of the GPIO when using higher speeds. I’m assuming it’s done in Nordic’s driver but unsure.

Also make sure that you’re using high impedance mode on your probes. It should still drive the signal no matter what but I guess it depends on the probe you’re using.

    zirunhong I’ve also noticed that the SD breakout you’re using has “3V Only” Witten all over it. The nRF9160 Feather is a 3.3V board so that could also be related to your speed issues. You can look at the data sheet for your card to confirm it’s operating range. Though, in this case, I’m not sure this is the main issue.

      jaredwolff Thanks for your reply.

      There’s also a mention of changing the drive strength of the GPIO when using higher speeds. I’m assuming it’s done in Nordic’s driver but unsure.

      • I see, so can I change the drive strength manually? If so, not sure if it is the correct, but I added the following after initial the file system:
                spim = device_get_binding(GPIO0);
        	if (spim == NULL) {
        		LOG_ERR("Error: device_get_binding()");
        		return 0;
        	}
        	res = gpio_pin_configure(spim, SCK_PIN, GPIO_OUTPUT | GPIO_DS_ALT_HIGH | GPIO_DS_ALT_LOW);
        	if (res < 0) {
        		LOG_ERR("set pin mode error\n");
        		return 0;
        	}

      Also make sure that you’re using high impedance mode on your probes. It should still drive the signal no matter what but I guess it depends on the probe you’re using.

      • The input impedance of the channel is marked as 1MOhms/15pF, so I think that should be in high impedance mode

      jaredwolff

      I’ve also noticed that the SD breakout you’re using has “3V Only” Witten all over it. The nRF9160 Feather is a 3.3V board so that could also be related to your speed issues. You can look at the data sheet for your card to confirm it’s operating range. Though, in this case, I’m not sure this is the main issue.

      • I checked the data sheet and it says: MicroSD cards must use 3.3V, so take care to only hook 3.3V to this pin. Hooking 5V or VBAT to this pin will damage your microSD card.

      @jaredwolff Zirun and I are working on this together. It would be amazing if you could confirm if we can get max SPI speed on this board or not. We need to be able to stream a number of seconds of audio data to the SD card or, possibly an external RAM chip but that would also be on the SPI bus. I spent a little bit of time troubleshooting this also but nothing stood out as a root cause. Perhaps it’s a limitation of the nRF9160?

      Thanks,
      Steven

        imoon Got it. I’ll reach out on Devzone to see if I get an answer from Nordic.

        jaredwolff
        Hey, I got the probe working and the frequency show on the scope is 250kHz not matter what frequency I was set

          zirunhong I saw your comment in the Nordic thread. Best to keep it going with them. I won’t be able to help you much more here.

            13 days later

            Hi,

            I finally figure out how to change the speed, not 100% sure if it is the best way to do so. I am still waiting for someone from Nodic DevZone to confirm on this thread.

            So what I have done is changing the SDHC_SPI_INITIAL_SPEED under zephyr\subsys\disk\disk_access_spi_sdhc.c to any frequency you want, in my case 4000000 (4MHz).

            Theoretically, I should change SDHC_SPI_SPEED instead, since it is the SPI speed after initialization, but somehow it is not working according to my observation. I guess that is because the SPI hardware register is not updated with the new speed according to the code, even though it is assigned to the data struct, so it keep using the initial speed all the time.

            Here is the result with the same code I posted:

            From the log:
            [00:00:00.480,438] <inf> main: Opening file path
            [00:00:00.569,824] <inf> main: Done opening file path
            [00:00:00.688,964] <inf> main: Done writing

            Speed is 32256 Bytes / (0.688964 - 0.569824) sec ~= 270 KB/s, almost ten times faster!

            From the scope:
            scope

            Hope that helps someone facing the similar issue!! Also thanks for your help @jaredwolff !

            Zirun

              zirunhong Thanks for sharing. Glad you’re making some progress. Sorry it’s not exactly what you wanted but it’s nice to see that you’re getting some improvement!

              Terms and Conditions | Privacy Policy