SPI chip works fine on a Uno but will not work with teensy 3.6
People
I could use some help. I designed a circuit board to drive motors using the teensy 3.6. I've been very happy with the teensies and use them to drive brushless gimbal motors for my robots: example.
So I designed another PCB to drive motors similar to the video but in this case I wanted to use the AMS AS5048A position sensor.
AS5048A brochure and datasheet.
This chip is 3.2v, uses SPI, and seems to be used quite commonly for this application. I have bought several modules from mouser.
There is a PWM out signal on the module that varies with position of a magnet. The module is also supposed to report the position via SPI. This works on the an Uno. When the module is connected to the teensy, the PWM out on the module still works - SPI does not. Indicating the chip is powered, and is reading the position properly, but communications seem to be broken.
The code is at this github repo.
The circuit is here
Board layout is here
The code engages in good SPI hygiene by opening and closing the connection with:
Ths max serial clock period on the AS5048A is 100 ns.
I am using the following pins on the teensy 3.6
Please help this monster come alive.
People
I could use some help. I designed a circuit board to drive motors using the teensy 3.6. I've been very happy with the teensies and use them to drive brushless gimbal motors for my robots: example.
So I designed another PCB to drive motors similar to the video but in this case I wanted to use the AMS AS5048A position sensor.
AS5048A brochure and datasheet.
This chip is 3.2v, uses SPI, and seems to be used quite commonly for this application. I have bought several modules from mouser.
There is a PWM out signal on the module that varies with position of a magnet. The module is also supposed to report the position via SPI. This works on the an Uno. When the module is connected to the teensy, the PWM out on the module still works - SPI does not. Indicating the chip is powered, and is reading the position properly, but communications seem to be broken.
The code is at this github repo.
The circuit is here
Board layout is here
The code engages in good SPI hygiene by opening and closing the connection with:
SPI.beginTransaction(settings);
//Send the command
digitalWrite(_cs, LOW);
SPI.transfer(left_byte);
SPI.transfer(right_byte);
digitalWrite(_cs,HIGH);
//Now read the response
digitalWrite(_cs, LOW);
left_byte = SPI.transfer(0x00);
right_byte = SPI.transfer(0x00);
digitalWrite(_cs, HIGH);
//SPI - end transaction
SPI.endTransaction();
Ths max serial clock period on the AS5048A is 100 ns.
I am using the following pins on the teensy 3.6
- SCK 13
- MISO 12
- MOSI 11
- CS 25
- SCK - Sporadic spikes highly, normally low
- MOSI - Sporadic spikes low, normally high
- MISO - Remains low
- CS - Sporadic spikes low, normally high
- Nothing else is on the SPI bus.
- Yes, I have checked all my connections a million times.
- No, I dont have a digital logic analyzer
Please help this monster come alive.
Last edited: