NuttX on a Netduino Plus 2; setup SD card support, pt 2

I rummage through the source for ENODEV and find that this is returned almost as a generic error message, so I add debug messages as breadcrumbs along the path of execution.  But where is the debug output going?  Well, I lost that when I went to the USB console.  It was suggested that I try the ‘ramlog’ device, which will then give me a ‘dmesg’ command.  I try, but this makes things much worse (board fails to boot), so in desperation I try re-enabling syslog and directing to USART2.  Now I have debug on on that port, and interactive console on the USB.

I discover that NuttX SPI has a notion of ‘status’.  This is not an intrinsic SPI concept, but something NuttX straps on to give some info about the device attached to that SPI port, and in fact it conveys things like ‘card inserted’, and ‘write protected’.  In fact the only statuses defined are SD-related.  So I modify up_spi.c stm32_spi3status() to indicate that.

Along the way I remembered that there are also power control lines for the SD and Ethernet controllers.  I add code to flick the power on, but no avail.

I break down and pull out the oscilloscope, and see no SPI clock.  In desperation I try flashing back the original Netduino firmware and see that SD doesn’t work there either!  What?  I try a different board, and it does work!  So I wasted a lot of time with a somehow defective board, I think, so I flashed NuttX on the known good board and it still doesn’t work.

I break out the oscilloscope and see no SPI clock, which I know has to be there sometime!  And of course I verify that with the original firmware (and discovered some interesting behaviour that explains some problems there, BTW, but that’s a separate topic).

And so I slunk away defeated.  For today.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s