Two SPI modules on Teensy 3.1: NOT

Status
Not open for further replies.
I'm building a high-speed SPI "Sniffer" and was excited to see in the MK20DX256VLH7 reference manual
https://www.pjrc.com/teensy/K20P64M72SF1RM.pdf, section 3.9.3.1 on page 128, and elsewhere
that the chip has two SPI modules. That means I can read both MISO and MOSI data simultaneously, running both modules in slave mode.

Alas, it isn't true. I couldn't figure out how to configure external pins to get access to the second SPI module, so I posted on Freescale's forum.
https://community.freescale.com/message/520001
One of the Freescale engineers investigated, and eventually responded that the documentation is wrong and will be corrected; that microcontroller has only one SPI module.

I can actually access the second module's registers, though, so I suspect the problem is that there is no way to configure external pins to be clock and select lines for the second module. But that makes it useless

The Teensy 3.1 table actually shows only one SPI module, so somehow Paul knew better than to believe the Freescale documentation!

This is just an FYI for anyone who might want to use two SPI modules. No action is required or requested of PJRC.

I solved my problem by adding an external CMOS shift register to capture the MISO data while running the first SPI in slave mode to capture the MOSI data. So I'm happily sniffing away, trying to understand how Honeywell's RedLINK wireless network works.

-- Len
 
A worthy project. Let me know if you have questions about the SPI Sniffer. It's been two years, so I've forgotten a lot about it, but I'll try to help.
These days I'd probably use a Teensy 3.5 or 3.6 to get the higher processing speed in the inner loop.
 
the shift registers need to be there? im assuming they are for reading miso and mosi at same time, wouldnt it be possible just to run the lines on teensy instead like how the i2c sniffer did? btw, i was able to get caller id, name, nmea data, and touch screen corrdinates off the hardware, probably will have them relay to an lcd screen on my dash :)
 
I initially tried using the SPI module on the chip to read the MOSI data, and a single external shift register to simultaneously read the MISO data. But because of the FIFO queuing on the chip, it was hard to figure out the timing and keep the bytes synchronized. Using two external shift registers was pretty easy and solved the problem.

I2C doesn't have the same problem because there is only one data line, so only one byte is transmitted at a time.
 
could of also used the non FIFO spi ports on the teensy 3.5/3.6, however, im only interested in 1 signal line
 
Status
Not open for further replies.
Back
Top