I have this issue with the SPI communication between the SAMD21G18 and a N25Q512A flash device, where it seems I cannot go behond 8MHz clock. (7.999.999 works, 8.000.000 works, 8.000.0001 and behond do not)
- Using SERCOM3, in DMA mode
- GCLK_GENERATOR_0, clk=48MHz
- Using the ASF framework
I have checked the actual electrical IF, and even if I set 16MHz clock, then the transmision towards the N25Q512A is correct, even the responses of the N25Q512A are correct. However the SAMD21 seems not to receive the correct data. If I use the normal bytewise ASF like:
FLASH_CE(1); spi_write_buffer_wait(&flash_spi_master,cmd,1); spi_read_buffer_wait(&flash_spi_master,&configReg.bytes,2,0); FLASH_CE(0);
then I can go upto 12MHz but also behond there it stops. On the same device I also use a SPI LCD (ILI9341 driver) and there I can transmit at 24MHz without error. As I am transferring data from the Flash towards the LCD it would be good to increase the reading speed of the flash to somewere around 16MHz.
As the boundary is exactly at 8 MHz, it seems there is something wrong internally inside the SAMD21, not so much witht he PCB layout. The signals look fine electrically (rise times etc).
I also discovered that if I put 12MHz into the SPI config like:
config_spi_master.mode_specific.master.baudrate = 12000000UL
the electrically measured clk frequency is around 12MHz. However, if I put in 12.000.001 than the clk jumps to the maximum 24MHz...is this normal?
Anyone a sugestion?