epsilonrt / ad7124

AD7124 ADC Library
Other
21 stars 16 forks source link

Problem with SPI communication on SAMD boards #12

Open fabienroots opened 4 years ago

fabienroots commented 4 years ago

Hi all,

This library works very well for RTD measurement on AVR boards like Arduino UNO.

But when i try to compile the same code for a SAMD Board like Cortex M0, i have a SPI compilation issue : \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp: In member function 'int Ad7124Driver::read(uint8_t*, uint8_t)': \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp:81:52: error: invalid conversion from 'uint8_t' {aka 'unsigned char'} to 'BitOrder' [-fpermissive] 81 | SPI.beginTransaction (SPISettings (speedMaximum, dataOrder, dataMode)); ^~~~~~~~~ | uint8_t {aka unsigned char} \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp:19: \Arduino15\packages\adafruit\hardware\samd\1.6.1\libraries\SPI/SPI.h:66:40: note: initializing argument 2 of 'SPISettings::SPISettings(uint32_t, BitOrder, uint8_t)' 66 | SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) { | ~~~~~~~~~^~~~~~~~ \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp: In member function 'int Ad7124Driver::write(const uint8_t*, uint8_t)': \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp:95:52: error: invalid conversion from 'uint8_t' {aka 'unsigned char'} to 'BitOrder' [-fpermissive] 95 | SPI.beginTransaction (SPISettings (speedMaximum, dataOrder, dataMode));

I'm not very familiar with SPI protocole, i make few chance but it doesn't work ...

I was hoping you could please assist

BEst regards

BastiaanMDC commented 4 years ago

Hi Fabian,

The AD7124 library works on the teensy3.6. Have it running. Spitting out voltages.

Did you load all programs into the arduino compiler?

Did you set the libraries in the specific order?

IT looks like you are writing a variable to something that isn’t declared where it should be.

I have a hunch that the problem lies in using the old spi drivers.

So first setup: SPI.begintransaction(clockspeed, MSBFIRST,spi_mode0); Digitalwrite(sspin,low);

//Do something here

DigitalWrite(sspin,HIGH); SPI.Endtransaction();

https://www.pjrc.com/teensy/td_libs_SPI.html

Do you plan to write your own cpp? Because I have no clue how to write something like CN0391 library.

Look up that library cn0391.h and cpp to get an idea how all of the whole thing works.

Allthough Its not user friendly.

Best regards

Bastiaan

Outlook voor iOShttps://aka.ms/o0ukef downloaden


Van: fabienroots notifications@github.com Verzonden: donderdag, september 17, 2020 11:59 AM Aan: epsilonrt/ad7124 CC: Subscribed Onderwerp: [ext] [epsilonrt/ad7124] Problem with SPI communication on SAMD boards (#12)

Hi all,

This library works very well for RTD measurement on AVR boards like Arduino UNO.

But when i try to compile the same code for a SAMD Board like Cortex M0, i have a SPI compilation issue : \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp: In member function 'int Ad7124Driver::read(uint8_t, uint8_t)': \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp:81:52: error: invalid conversion from 'uint8_t' {aka 'unsigned char'} to 'BitOrder' [-fpermissive] 81 | SPI.beginTransaction (SPISettings (speedMaximum, dataOrder, dataMode)); ^~~ | uint8_t {aka unsigned char} \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp:19: \Arduino15\packages\adafruit\hardware\samd\1.6.1\libraries\SPI/SPI.h:66:40: note: initializing argument 2 of 'SPISettings::SPISettings(uint32_t, BitOrder, uint8_t)' 66 | SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) { | ~~~^~~~ \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp: In member function 'int Ad7124Driver::write(const uint8_t, uint8_t)': \Arduino\libraries\ad7124-master\src\ad7124-driver.cpp:95:52: error: invalid conversion from 'uint8_t' {aka 'unsigned char'} to 'BitOrder' [-fpermissive] 95 | SPI.beginTransaction (SPISettings (speedMaximum, dataOrder, dataMode));

I'm not very familiar with SPI protocole, i make few chance but it doesn't work ...

I was hoping you could please assist

BEst regards

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/epsilonrt/ad7124/issues/12, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH6OTURTMUVFEOHE5E2PNODSGHMXLANCNFSM4RQFUQQA.