Ran into issues where large buffer, were not fully outputting the right data.
Was seeing it on RA8876 on pages from DMAMEM and at times EXTRAM.
Turns out where I did the arm_dcache_flush (or delete) I had already decreased the count to be the max size I could output in any one DMA operation without chain... So now do it before we check for MAX size...
Appears to fix the display issue I was seeing
The CS pins on T4.x are not like 3.x in that is you select one by index, not one or more by mask. So changed returned values to be index (1 based)
Also while testing I pulled in Frank's change for adding delay after CS pin is logically selected.
Double checked the pin definitions and forgot to update that
there is MISO1 on pin 39, likewise CS1-0 on pin 38
Also SPI0 has two additional CS pins on 37 and 36.
I changed the Clock that was used and settings.
So I think maximum speed changed from about 37+mhz to 60mhz
I was haing issues at 60mhz with simple test so also changed the IO ins Speed and DSE values which appeared to work.
I tried running our ILI9488_t3 library at 60mhz and it appears to work :D
The code would fail if the user did an SPI.transfer without calling SPI.beginTransaction.
So begin now calls beginTransaction with default parameters.
Also put in an implemention for SPI.setClockDivider as well as SPI.setDataMode
They appear to work OK... Tried to do with out changing any of the current functionality other than to call begin/end transaction in begin to get to a stable state.
There have been some issues with SCK pins and the like not appearing to work as well as on T3.x...
We have been experiementing with changing the DSE and SPEED value and this has helped in some cases.
With the T4 transaction code settings being dependent on which clock is choosen to be used in SPI. All of the work had to be done at run time.
As such the statically defined ones may not work as you have no idea which clock may be actually used...
So moved the work to comput CCR into the SPI.beginTransaction code, which is only called if something like the clock speed is different than the previous call to beginTransaction
We can still convert the bit Order and Data Mode parameters into the TCR
register value as part of the SPISettings constructor code as these do
not depend on external run time settings.
Some of the SPI pins for SPI1 and SPI2 require
changing the Input chain mux registers. So those register pointers and values are not stored in the SPI object and are updated as part of the begin
If a buffer is up in the high memory, that is either in the area marked DMARAM or created by malloc and you try to do a SPI transfer using DMA, the code detects the addresses >= 0x20200000 and then calls the system functions to either flush the cache or delete the cache on the read...
Still testing and running into memory usage issues, but I think some of the basics are working. Still need to do more testing, including verifying on larger buffers.
Added - the code to set them as part of the Transaction Setttings.
Also put in implementations for,
SPI.setBitOrder and SPI.setDataMode.
Note the setDatMode like the T3.x does not appear to do anything yet.