I come across this recently during a library development.
In brief, call any spi function without instantiate an SPI.begin() first, will cause a freeze of teensy board and a consequential "usb device not recognized..." OS system driver error!
here's an example:
Code:
#include <SPI.h>
const int slaveSelectPin = 10;
void setup() {
// set the slaveSelectPin as an output:
pinMode (slaveSelectPin, OUTPUT);
// initialize SPI:
//SPI.begin();
}
void loop() {
digitalWrite(slaveSelectPin,LOW);
SPI.transfer(0x00);
SPI.transfer(0);
digitalWrite(slaveSelectPin,HIGH);
delay(1000);
}
The code compile fine and just after transfer I got an "usb device not recognized..." error from windows. To "resuscitate" teensy 3 I just have to upload any working code and press 2 times reset.
In my system this is always repicable.
OS:Win7 32bit
IDE:beta8
Board:Teensy3
Anyone can confirm this?