-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FT812 Display SPI communication #135
Comments
Hello, I am not familiar with the ATSAM4C series, I started with ATSAMC21 and ATSAME51 and from what I found now the ATSAM4C is an earlier series and somewhat "legacy" while still in production? We are talking about chips like the ATSAM4C16CB-AU? As this family is currently not directly supported, what did you do to integrate it? You probably did not add DMA code to EVE_target.c so far? Do you have a logic analyzer?
But hopefully not for the init phase? A compileable example to look at that is stripped of everything else would be nice. |
I just remembered, I do have a SAME70 Xplained and the SPI seems to be fairly similar. |
30MHz is internal clock of that controller, except for that frequency for any other frequency it's not working, using same frequency for init, |
So that is not the resulting SPI clock then?
That is odd.
At init, the SPI clock must not be faster than 11MHz. I am playing with the ATSAME70 XPlained right not, but I am still stuck at lighting up the LED on PC8. I am up to this now: And the LED still is off. So far I am not regretting that I stuck with the newer C21 / E51. :-) |
hi, #define EVE_SPI SPI0 /* the SPI port to use */ static inline void EVE_pdn_set(void) static inline void EVE_pdn_clear(void) static inline void EVE_cs_set(void) static inline void EVE_cs_clear(void) static inline void spi_transmit(uint8_t data) static inline void spi_transmit_32(uint32_t data) /* spi_transmit_burst() is only used for cmd-FIFO commands / static inline uint8_t spi_receive(uint8_t data) while (!(SPI0->SPI_SR & SPI_SR_TDRE)); while (!(EVE_SPI->SPI_SR & SPI_SR_RDRF)); return tx_data; static inline uint8_t fetch_flash_byte(const uint8_t *p_data) |
Hello, I can not try this for myself here as my E70 behaves quite weird. And in spi_receive() you are probably reading data from the previous transfer as the current transfer is not done yet and the previous transfer already set RDRF. A logic analyser trace would be most helpfull.
Just looking briefly at the datasheet I am not even sure where the peripheral clock is controlled. |
After adding TXEMPTY to our code, now it is working perfectly.. |
Nice. |
yeah, i attached the target file for SAM4C series. And before EVE_init() to all over the program im running it with 30MHZ from PLLB using SCBR, other than that its not working in any frequency. and still facing some issues randomly when EVE_reset(). CPURESET readback giving 3 instead of 0, because of that sometimes the commands are not updating it seems. |
Thank you! Here, I went over it, added a header with a license, added include guards, made EVE_SPI configureable and added the missing DELAY_MS(). So if you are ok with this, I'll integrate it. But if you are not ok with this, especially the author and copyright reference, please edit the file accordingly.
I still would like to see a logic analyzer trace, from startup to first real screen and including PD. |
yeah no issues regarding copyrights, i just modified from your repository thanks to you, so there is no need of formality i think :) And i will capture and comment you the traces through oscilloscope. |
I didn't notice, one small change in that file is that as you said, here im reading the data from previous transmission, so in SPI_recieve() function after sending dummy byte we should check for TXEMPTY flag and after that we should read. |
Hi,
When we execute my code using SPI communication from SAM4C controller, we were able to change only display color, remaining commands of text or buttons not working burst commands not executing only command executing without burst only once.
Any solutions?
SPI frequency 30MHz
The text was updated successfully, but these errors were encountered: