Hello All,
I am trying to get the SPI working on Teensy 3.1 for RFM22B. Need help with my SPI driver.
Tried the SPI (I guess default lib) mentioned in www.pjrc.com, but it did not work.
So wrote my BitBanged SPI to test the h/w, and it worked, i.e. I could read the RFM22 Register.
Next, I tried the Fast SPI lib from Btmcmahan, Had to fix some Registers (like SPI_.. to SPI0_.. ), and map it to my SPI CS, but could not get it to work either
So, finally decided to write my own, ..but my code hangs when I initialize the SPI MCR register!!
i.e. when I write to register..
SPI0_MCR = 0x80000000;
(My heart beat LED stops blinking)
I have included header file
#include <mk20dx128.h>
#include <core_pins.h>
Just wanted to add, I am not sure if there is a specific way to include lib in Arduino.
i.e. I did not select "Sketch->Import Library->SPI" to import SPI lib, just included SPI.h file and invoked the SPI APIs but the code was not hanging, i.e. my heart beat LED blinks.
Do we need to enable the SPI core in the chip, or enable clocks to it ? Writing 0x0 to MCR register hangs, so I would guess there is no clocks to the SPI core where this (MCR) register is implemented.
Any help is appreciated.
Regards,
Vignesh
I am trying to get the SPI working on Teensy 3.1 for RFM22B. Need help with my SPI driver.
Tried the SPI (I guess default lib) mentioned in www.pjrc.com, but it did not work.
So wrote my BitBanged SPI to test the h/w, and it worked, i.e. I could read the RFM22 Register.
Next, I tried the Fast SPI lib from Btmcmahan, Had to fix some Registers (like SPI_.. to SPI0_.. ), and map it to my SPI CS, but could not get it to work either
So, finally decided to write my own, ..but my code hangs when I initialize the SPI MCR register!!
i.e. when I write to register..
SPI0_MCR = 0x80000000;
(My heart beat LED stops blinking)
I have included header file
#include <mk20dx128.h>
#include <core_pins.h>
Just wanted to add, I am not sure if there is a specific way to include lib in Arduino.
i.e. I did not select "Sketch->Import Library->SPI" to import SPI lib, just included SPI.h file and invoked the SPI APIs but the code was not hanging, i.e. my heart beat LED blinks.
Do we need to enable the SPI core in the chip, or enable clocks to it ? Writing 0x0 to MCR register hangs, so I would guess there is no clocks to the SPI core where this (MCR) register is implemented.
Any help is appreciated.
Regards,
Vignesh