RudolphRiedel / FT800-FT813

Multi-Platform C code Library for EVE graphics controllers from FTDI / Bridgetek (FT810, FT811, FT812, FT813, BT815, BT816, BT817, BT818)
MIT License
128 stars 57 forks source link

Add support for SAMD51P20A (Adafruit Grand Cental M4) #9

Closed sl1pkn07 closed 4 years ago

sl1pkn07 commented 4 years ago

Add support for test the library with Adafruit Grand Central M4 board (SAMD51P20A) with EVE_Test_Arduino_PlatformIO example

sl1pkn07 commented 4 years ago

IMG_20200421_130258

RudolphRiedel commented 4 years ago

Hmmm, I am 100% certain that I commented on this one before. While it is always a good idea to support more boards, the proposed changes in this case are not necessary and there is a much simpler solution. At least in the context of this code the SAMD51P20A and the SAME51J19A are exactly the same. Unfortunately there are no family defines declared like SAMx5x or SAMC2x.

So you can just add more controllers in the same family to the existing block:

if defined (SAMC21E18A) || (SAME51J19A) || (SAMD51P20A) || (SAMD51J19A)

#include "sam.h"

#define EVE_CS_PORT 0
#define EVE_CS PORT_PA05
#define EVE_PDN_PORT 0
#define EVE_PDN PORT_PA03
#define EVE_SPI SERCOM0
#define EVE_SPI_DMA_TRIGGER SERCOM0_DMAC_ID_TX
#define EVE_DMA_CHANNEL 0
#define EVE_DMA
#define EVE_DELAY_1MS 8000   // ~1ms at 48MHz Core-Clock

The SAMD51J19A is on the Metro M4. Or well, just replace the SAME51J19A with any other from that family tree. Like SAMD51G18A or SAME54N20A.

That there are two blocks of settings right now in EVE_target.h is out of conveniance for me since I am using two boards to test with.

It gets a little more complicated in EVE_target.c since DMA is a little different between SAMC2x and SAMD5x/SAME5x. But then this also is just like this:

if defined (SAME51J19A) || (SAMD51P20A) || (SAMD51J19A)

void EVE_init_dma(void)

Btw. I did some some cleanup and measured the timing for the SAME51 again. The correct value for EVE_DELAY_1MS is 20000 with a core clock of 120MHz and activated cache.