SteveBar
Well-known member
Hi All,
I'm trying to get the MD_MAX72xx lib to use HW SPI2 on Teensy 4.1. (SPI1: MOSI1=26, SCK1=27, CS1=0 or 38)
Using the 5 param call results in a BIT Bangged "SPI" (not the goal) which works, but NOT via HW SPI...
from MD_MAX72xx.cpp (line ~328)
using the 3 param call supposed to get HW SPI (is the goal) which does not work...
from MD_MAX72xx.cpp (line ~323)
I added a few comments in the MD_Max code and SPI.cpp to monitor the type and use of the SPI. It shows (when using the 3 param call) that HW SPI is being used by the MD_Max lib but the SPI is using MISO: 12 MOSI: 11, SCK: 13.
MD_MAX72XX::begin _hardwareSPI=1
MD_MAX72XX::ARDUINO SPIbegin _hardwareSPI=1
SPIClass::SPI MISO: 12 MOSI: 11, SCK: 13
Questions:
1) How can I get the MD_Max and SPI libs to use the SPI2 of the T41?
2) Where/How does MD_Max and SPI libs "know" which MISO, MOSI, & SCK pins to use when I send it the CS pin only? I assume it knows that its a T41 etc...
Thanks
Steve
I'm trying to get the MD_MAX72xx lib to use HW SPI2 on Teensy 4.1. (SPI1: MOSI1=26, SCK1=27, CS1=0 or 38)
Using the 5 param call results in a BIT Bangged "SPI" (not the goal) which works, but NOT via HW SPI...
Code:
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLOCK_PIN 27
#define MOSI_PIN 26
#define CS_PIN_MATRIX 0 // or 38
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, MOSI_PIN, CLOCK_PIN, CS_PIN_MATRIX, MAX_DEVICES);
from MD_MAX72xx.cpp (line ~328)
Code:
else { // not hardware SPI - bit bash it out
for (uint16_t i = 0; i < SPI_DATA_SIZE; i++)
shiftOut(_dataPin, _clkPin, MSBFIRST, _spiData[i]);
}
using the 3 param call supposed to get HW SPI (is the goal) which does not work...
Code:
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
//#define CLOCK_PIN 27
//#define MOSI_PIN 26
#define CS_PIN_MATRIX 0 // or 38
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN_MATRIX, MAX_DEVICES);
from MD_MAX72xx.cpp (line ~323)
Code:
if (_hardwareSPI) {
for (uint16_t i = 0; i < SPI_DATA_SIZE; i++)
SPI.transfer(_spiData[i]);
}
I added a few comments in the MD_Max code and SPI.cpp to monitor the type and use of the SPI. It shows (when using the 3 param call) that HW SPI is being used by the MD_Max lib but the SPI is using MISO: 12 MOSI: 11, SCK: 13.
MD_MAX72XX::begin _hardwareSPI=1
MD_MAX72XX::ARDUINO SPIbegin _hardwareSPI=1
SPIClass::SPI MISO: 12 MOSI: 11, SCK: 13
Questions:
1) How can I get the MD_Max and SPI libs to use the SPI2 of the T41?
2) Where/How does MD_Max and SPI libs "know" which MISO, MOSI, & SCK pins to use when I send it the CS pin only? I assume it knows that its a T41 etc...
Thanks
Steve