1
\$\begingroup\$

Can the CANRX and CANTX bus be used as ADCs on the Arduino Giga R1?

We have tried a few things with it but always returns either an error or a failure.

For instance, we called analogRead on the pins PB5 and PB13, but it is not giving us a proper reading.

For example, for a 16 bit read, 0 would be 0 and 65535 would be 1. There is no in between.

The official documentation states two times that these pins can be used as ADC pins.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Arduino-this-and-that doesn't say jack to the average electrical engineer, since Arduino isn't used in (proper) engineering. Does the MCU on the board allow it, is what you should be asking. Which you no doubt can find out by reading the manual of said MCU and see if it supports peripheral routing of the ADC. That being said, it sounds like the actual thing you need is not an ADC but a GPIO with Schmitt trigger input which turns something to logical 1 or 0. The MCU won't likely have that on-board, so you'd have to use an external 74HC part. \$\endgroup\$
    – Lundin
    Commented Aug 15 at 11:01

1 Answer 1

1
\$\begingroup\$

According to this page in the Arduino documentation, you need to do a couple of things:

  1. Use the Arduino_AdvancedAnalog library to access the ADCs.
  2. Use the predefined constants "CANRX" and "CANTX" as parameters to the "AdvancedADC" constructor.

There's an example on the linked page. Simply replace "AdvancedADC adc1(A0);" with "AdvancedADC adc1(CANRX);"

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.