Hello,
I have several questions about SPI in Kinetis devices:
1. We need to use an MCU which has two separate SPI interfaces - one as Master and one as Slave.
How can I know which MCU supports this? I couldn't find any place which describes this, the closest I saw are product briefs, but it still doesn't show it exactly.
2. Does the K11 subfamily support two separate SPI interfaces - one as Master and one as Slave?
3. Does any of the Cortex M0+ KL1x support two separate SPI interfaces - one as Master and one as Slave?
4. If we develop support for the two SPIs on K1x, will the same firmware work also on KL1x?
5. Is there a pin compatible package between K1x and KL1x with both kinds of SPIs available on same pins?
6. Can both SPI master and SPI slave both use DMAs in parallel?
7. Is it possible to manually generate CS from regular GPIO and connect them to slaves while using the regular hardware SPI Master?
Thank you,
Pavel
Hi
1. All Kinetis parts have SPI interface(s). The number varies and I don't know of a comparison showing which ones have how many. Since you know approximately the family/families that you would like to use it is best to open the user's manual of each type and go to the PINOUT section. Then search for SPi ynd you will see how mayn theer are any on which pins they are available on. This may change for different packages of course since packages with less pins may not have all of the peripheral connectiosn that larger packages of the same chip do.
Also, if you open the data sheets to each type there is usually an overview of the communication interfaces which gives the number of SPI moduels included.
2. The K11 in 80 pin package has 2 independent SPIs (SPI0 and SPI1) so one could be used as master and one as slave.
3. KL1x parts all have 2 independent SPIs
4. K1x have DSP and K1x have SPIs - these are quite different and so there will be some firmawrae differences. (DSPI has FIFOs and the SPIs don't - also the DSPIs can control the CS lines as part of the FIFO content.
5. I think that an 80 pin K11 and K14 are pin compatible - for example - but not all peripheral functions are the same. You will need to check every pin carefully to be sure, but I think that you should find that a single footprint will be useable with a number of different devices (both K and Kl parts).
6. The DMA controllers are very flexible and so both SPI can use then in Rx and TX directions at the same time (there is a limit to the total number of channels - a K11 has 16 and KL14 has 4 so this woudl use up all DMA channels on the KL14).
7.It is always possible to control CS from any GPIO. The DSPI in the K11 allows more automatic control but this is optional.
Regards
Mark
Thanks Mark for great reply!
4. K1x have DSP and K1x have SPIs - these are quite different and so there will be some firmawrae differences. (DSPI has FIFOs and the SPIs don't - also the DSPIs can control the CS lines as part of the FIFO content.
Did you mean that K1x have DSPIs and KL1x have SPIs?
Since K1x and KL1x have different SPI, is there a chance to make same firmware code easily portable from one to the other?
If we are using DMAs (and not internal FIFOs on the DSPI) will the firmware be mostly compatible between K1x and KL1x?
Thanks again!
Pavel
Pavel
Yes, I meant DSP (not DSP).
It is simple to write code that is compatible between DSPI and SPI. I have the following drivers for both:
- SD card drivers in SPI mode.
- SPI Flash drivers for AT45DBxxx, ST micro and SST devices.
I need just a few #if defs to handle the slight differences (whether using FIFOs, DMA or not)
Regards
Mark