-->
Page 2 of 2

Re: Problems with MCP2515 breakout board (8MHZ clock)

PostPosted: Mon Aug 29, 2016 9:51 am
by phenoboy
martinayotte wrote:You should use the HSPI on GPIO12-GPIO15.
(The SPI is dedicated to the Flash)


Thanks for the confirmation.

Re: Problems with MCP2515 breakout board (8MHZ clock)

PostPosted: Mon Aug 29, 2016 11:22 am
by picstart
The arduino esp8266 IDE will use the HSPI pins hardware. HSPI uses fixed pins GPIO 12 13 14.
In setup you need something like this
SPI.begin();
//SPISettings mySettting(speedMaximum, dataOrder, dataMode)
SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
Since SPI has 4 modes you need to know from the specs the mode for the MCP chip and the endiness for the data plus the max transfer speed
Now the spi transfers need to be preceded by digitalWrite(CSpin, LOW); and followed by digitalWrite(CSpin, HIGH);
if you use a CS pin other than GPIO15

Re: Problems with MCP2515 breakout board (8MHZ clock)

PostPosted: Tue Aug 30, 2016 3:04 am
by phenoboy
picstart wrote:The arduino esp8266 IDE will use the HSPI pins hardware. HSPI uses fixed pins GPIO 12 13 14.
In setup you need something like this
SPI.begin();
//SPISettings mySettting(speedMaximum, dataOrder, dataMode)
SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
Since SPI has 4 modes you need to know from the specs the mode for the MCP chip and the endiness for the data plus the max transfer speed
Now the spi transfers need to be preceded by digitalWrite(CSpin, LOW); and followed by digitalWrite(CSpin, HIGH);
if you use a CS pin other than GPIO15


Thanks, got it! The MCP_CAN library takes care of asserting CS lines and seems to be quite straightforward to use.

I still don't understand why the board manufacturer put CLK, etc. labels for SPI and not HSPI pins. Got me really confused..