I wrote a code for the Arduino nano to control the AD5932 and it worked fine. I transferred the code to the teensy and it stopped working.
Teensy 4.1 pinout
11-SData
13-SCLK
2-FSYNC
3-CTRL
4-Interrupt
5-Standby
GND-AGND (I connected all the grounds and it works on Arduino)
What happens if I execute the code on the teensy is that nothing happens.
I can see on my oscilloscope that I transfer 2x 8bit over pins 11 and 13. SCK is 935kHz but nothing happens.
AD5932 Datasheet:
https://www.analog.com/media/en/technical-documentation/data-sheets/AD5932.pdf
https://www.analog.com/media/en/technical-documentation/application-notes/AN-1044.pdf
GitHub with all the code as well
https://github.com/Tobias12343123/AD5932_Arduino_Teensy4.1.git
I also get the warnings but not always:
In file included from C:\Users\-------\AppData\Local\Temp\arduino_build_238584\sketch\Ad5932.cpp:3:0:
C:\Users\-------\AppData\Local\Temp\arduino_build_238584\sketch\Ad5932.h: In constructor 'Ad5932::Ad5932()':
Ad5932.h:27: warning: 'Ad5932::_oscillator' will be initialized after
float _oscillator; //variable oscillator
^
Ad5932.h:21: warning: 'uint8_t Ad5932::_fsync'
uint8_t _fsync; //pin fsync
^
Ad5932.cpp:6: warning: when initialized here
Ad5932::Ad5932(): _oscillator(0), _fsync(0), _ctrl(0), _interrupt(0), _standby(0),_controlRegister(), _frequency(5), _nbIncrement(2), _intervalDuration(0)
^
Memory Usage on Teensy 4.1:
FLASH: code:14072, data:3628, headers:8920 free for files:8099844
RAM1: variables:12992, code:11400, padding:21368 free for local variables:478528
RAM2: variables:12384 free for malloc/new:511904
Teensy 4.1 pinout
11-SData
13-SCLK
2-FSYNC
3-CTRL
4-Interrupt
5-Standby
GND-AGND (I connected all the grounds and it works on Arduino)
What happens if I execute the code on the teensy is that nothing happens.
I can see on my oscilloscope that I transfer 2x 8bit over pins 11 and 13. SCK is 935kHz but nothing happens.
AD5932 Datasheet:
https://www.analog.com/media/en/technical-documentation/data-sheets/AD5932.pdf
https://www.analog.com/media/en/technical-documentation/application-notes/AN-1044.pdf
GitHub with all the code as well
https://github.com/Tobias12343123/AD5932_Arduino_Teensy4.1.git
I also get the warnings but not always:
In file included from C:\Users\-------\AppData\Local\Temp\arduino_build_238584\sketch\Ad5932.cpp:3:0:
C:\Users\-------\AppData\Local\Temp\arduino_build_238584\sketch\Ad5932.h: In constructor 'Ad5932::Ad5932()':
Ad5932.h:27: warning: 'Ad5932::_oscillator' will be initialized after
float _oscillator; //variable oscillator
^
Ad5932.h:21: warning: 'uint8_t Ad5932::_fsync'
uint8_t _fsync; //pin fsync
^
Ad5932.cpp:6: warning: when initialized here
Ad5932::Ad5932(): _oscillator(0), _fsync(0), _ctrl(0), _interrupt(0), _standby(0),_controlRegister(), _frequency(5), _nbIncrement(2), _intervalDuration(0)
^
Memory Usage on Teensy 4.1:
FLASH: code:14072, data:3628, headers:8920 free for files:8099844
RAM1: variables:12992, code:11400, padding:21368 free for local variables:478528
RAM2: variables:12384 free for malloc/new:511904