Sorry for delay ,
Yes I was able to test today and it is working ok Compile very well in arduino IDE 1.6.5
See below my code for SPI2
#include <SPI.h>
SPIClass SPI_2(2); //Create an instance of the SPI Class called SPI_2 that uses the 2nd SPI Port
void initSPI2() {
//SPI_DISABLE();
SPI_2.end();
SPI2_BASE->CR1 &=~SPI_CR1_DFF_8_BIT;//8 bits format This bit should be written only when SPI is disabled (SPE = �0�) for correct operation.
SPI_2.begin(); //Initialize the SPI_2 port.
SPI_2.setBitOrder(MSBFIRST); // Set the SPI_2 bit order
SPI_2.setDataMode(SPI_MODE0); //Set the SPI_2 data mode 0
SPI_2.setClockDivider(SPI_CLOCK_DIV32); //// Slow speed (36 / 32 = 1.125 MHz SPI_2 speed) It is not worlking witvDIV16 and higher
}
uint16_t _spi_write(uint16_t command){
SPI2_BASE->DR = command;
while (!(SPI2_BASE->SR & SPI_SR_RXNE));
//SPI_2.transfer(command);//working also with this one only
return SPI2_BASE->DR;
}
uint8_t _spi_read(){
uint8_t rx=0;
SPI_DISABLE();
SPI_SET_BIDIRECTIONAL();
SPI_ENABLE();
while(!(SPI2_BASE->SR& SPI_SR_RXNE));
rx=SPI2_BASE->DR;
SPI_DISABLE();
SPI_SET_UNIDIRECTIONAL();
SPI_ENABLE();
return rx;
}
void SPI_ENABLE(){
SPI2_BASE->CR1 |= SPI_CR1_SPE;//enable SPI
}
void SPI_DISABLE(){
SPI2_BASE->CR1 &= ~SPI_CR1_SPE;//disable SPI
}
void SPI_SET_BIDIRECTIONAL()
{
SPI2_BASE->CR1 |= SPI_CR1_BIDIMODE;
SPI2_BASE->CR1 &= ~ SPI_CR1_BIDIOE;//receive only
}
void SPI_SET_UNIDIRECTIONAL()
{
SPI2_BASE->CR1 &= ~SPI_CR1_BIDIMODE;
}
The spi speed cannot be increased more than 1.125 MHz clock DIV32.The A7105 gives error byte readings.
Another thing I observed there is a pain in the ass to find a tutorial explaining how SPI port other than SPI1 to be set.The original maple HardwareSPI class is not usable anymore.