I have upgraded the SPI handler to interleave chatter with multiple SPI devices.  The problem is that I only have one SPI device that I know works.  I tried plugging in a uSD card and talking to it, but I’m not getting anything definitive back from it.  It may be answering, or maybe not.  I don’t want to write all that protocol code for talking to the uSD card yet.

I really wish I had some dumb-arse SPI device I could use to check out the code.

However it all seems to work, as far as it goes.  I keep swapping between the DW and the uSD (working or not) and the DW keeps working just fine, so I think I’m going to declare victory and move on.

One thing I notices, and which disappoints me, is that the processor doesn’t sleep between character interrupts on the UART, or between bytes on the SPI.  I’m not sure how much there is to be saved there, because the thread-suspend/recover code is probably quite substantial, and I suspect the scheduler doesn’t send things to sleep unless there is a promising delay coming up.

        rtos_suspend   = 1;
        expected_time  = os_suspend();
        expected_time &= TIMER_MASK;

        if (expected_time > 2)
        {
            prev_time       = NRF_RTC1->COUNTER;
            expected_time  += prev_time;
            NRF_RTC1->CC[0] =
                (expected_time > TIMER_MASK) ? expected_time – TIMER_MASK : expected_time;

Leave a Reply