Kurt,
OK commenting out debug stuff got simple sketch running. I still get errors requesting SPI CLK of 15mhz with flex clock @30mhz. no errors for slower SPI CLK speedsl
Code:
Updated Flex IO speed: 30000000
SPIHZ 15000000
547 us 15.0 mbs
errs 1023 [3] 1
0 0 0
1 1 0
2 2 129
3 3 1
4 4 130
500 244 250
501 245 122
502 246 251
503 247 123
504 248 252
1020 252 254
1021 253 126
1022 254 255
1023 255 127
scope shows pin 4 running at 14.7 mhz
FYI - I just pushed up a different implementation of the SPIFlex(buf, retbuf, cnt), that may work differently. At least it is not hanging on my test program.
I put the reads and writes more in lock step, that is it:
puts first char out, waits until it can put second char out does write, waits until it can read something, reads it in, waits for wri.... until the end when it waits to read in the last two chars...
Also pushed up fix that internal to the transfer function it was using an uint16_t for count where I might pass in > 64K....
I had test program do: SPIFLEX.flexIOHandler()->setClockSettings(3, 2, 0); // clksel(0-3PLL4, Pll3 PFD2 PLL5, *PLL3_sw)
Which should give the Flex IO speed of 480000000U/(3) = 160mhz
If I ask for 30mhz I am getting about 25mhz.
I need to play around some more but you might give it a try. I am seeing some interesting stuff with the DMA version and my SPI pin (which is not controlled by FlexIO).
You see normal stuff:
But if I look at the DMA output:
You see a jitter going the CS pin.
That is the test code does stuff like:
Code:
digitalWriteFast(CS_PIN, LOW);
SPIT.transfer(buffer, rxBuffer, SMALL_TRANSFER_SIZE, event);
...
void asyncEventResponder(EventResponderRef event_responder)
{
digitalWriteFast(CS_PIN, HIGH);
event_happened = true;
}
The Async code should have setup the TX/RX transfers up to 32K and when the ISR happens if the request was for more than 32K it should restart the DMA and only after all that has completed should the event responder be called... But in this case the transfer size was 128...
EDIT: Should mention that I don't see the CS pin output being corrupted like this if I remove the call: SPIFLEX.flexIOHandler()->setClockSettings(3, 2, 0)
So left the FLex bus running at : 480000000U/(2*8) = 30mhz
Edit2: Looks like I need to do a little more testing/updates, that is my dual display SSD1306 is hanging when I do the Flex display update along with the SPI doing Async update... Will try some more hacks here...