All I want is to send a contiguous byte stream via SERCOM with a 2.5MHz bit rate. Am I asking too much? (See also https://community.atmel.com/foru...)
Running on a SAMD11 Xplained Pro clocked at 48MHz, I've used Atmel START to configure SERCOM1 using the Master DMA driver, transmit only. As a simple test, I want to send three bytes without any timing gap between. Cribbing code from the examples directory, I have the following.
It is supposed to send three bytes back-to-back and then sleep for a millisecond before repeating:
#include "atmel_start.h" #include "atmel_start_pins.h" static uint8_t s_pixels[] = {0x01, 0xfe, 0x55}; static void tx_complete_cb_RGB_COM(struct _dma_resource *resource) { /* Transfer completed */ asm("nop"); } static void RGB_loop(void) { struct io_descriptor *io; spi_m_dma_get_io_descriptor(&RGB_COM, &io); spi_m_dma_register_callback(&RGB_COM, SPI_M_DMA_CB_TX_DONE, tx_complete_cb_RGB_COM); spi_m_dma_enable(&RGB_COM); while (true) { io_write(io, s_pixels, sizeof(s_pixels)); delay_ms(1); } } int main(void) { atmel_start_init(); RGB_loop(); }
... but as far as my scope can tell me, it doesn't even write one byte.
What am I missing?
P.S.: I've used the same setup in Master Async and Master Sync mode, so I can eliminate hardware as the source of trouble. The only problem with Async and Sync mode is that the emitted bytes are not contiguous.