Hi guys,
I’m having a lot of trouble programming the qtpy esp32s3 using the platformio. More precisely I cannot get the SPI to work.
Here is my current ini file:
[env:adafruit_qtpy_esp32s3_nopsram]
board = adafruit_qtpy_esp32s3_nopsram
board_build.mcu = esp32s3
board_build.f_cpu = 240000000L
framework = arduino
platform = espressif32
upload_protocol = esptool
platform_packages =
framework-arduinoespressif32@3.2.0
lib_archive = false
I’m trying to upload the sensor test example
#include <Arduino.h>
#include <SimpleFOC.h>
#include <SPI.h>
// alternative pinout
#define SPI_MISO MISO
#define SPI_MOSI MOSI
#define SPI_SCLK SCK
#define SPI_SS RX
// MagneticSensorSPI(int cs, float _cpr, int _angle_register)
// config - SPI config
// cs - SPI chip select pin
MagneticSensorSPI sensor = MagneticSensorSPI(AS5048_SPI, SPI_SS);
void setup() {
_delay(5000); // wait for the serial to be ready
// monitoring port
Serial.begin(115200);
// initialise magnetic sensor hardware
sensor.init();
Serial.println("Sensor ready");
_delay(1000);
}
void loop() {
// iterative function updating the sensor internal variables
// it is usually called in motor.loopFOC()
// this function reads the sensor hardware and
// has to be called before getAngle nad getVelocity
sensor.update();
// display the angle and the angular velocity to the terminal
Serial.print(sensor.getAngle());
Serial.print("\t");
Serial.println(sensor.getVelocity());
_delay(100); // Add a small delay to avoid flooding the serial output
}
I can upload the code and do get an output but its always zero.
I’ve checked with the scope and there is no SCK signals sent, I can see the MOSI and the CS being sent but no SCK. I am not really sure what does that mean. I imagine it’s some kind of misconfiguration.
The same code works with the Arduino IDE. I am not sure what am I missing.
If some of you have experienced something similar I would appreciate any pointers