Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: basic MPC3202 reading problem

  1. #1

    basic MPC3202 reading problem

    Hi,

    I'm trying something very simple: reading samples from an MCP3202.
    I can't get it to work.

    #include <SPI.h>
    #include <Mcp320x.h>

    #define SPI_CS 10 // SPI slave select
    #define ADC_VREF 3300 // 3.3V Vref
    #define ADC_CLK 1600000 // SPI clock 1.6MHz

    MCP3202 adc(ADC_VREF, SPI_CS);

    void setup() {
    Serial.begin(115200);

    pinMode(SPI_CS, OUTPUT);
    digitalWrite(SPI_CS, HIGH);

    SPISettings settings(ADC_CLK, MSBFIRST, SPI_MODE0);
    SPI.begin();
    SPI.beginTransaction(settings);
    }

    void loop() {
    Serial.println(adc.read(MCP3202::Channel::SINGLE_0 ));
    }

    I triple checked the wiring of course but I get no output at all.
    I'm using this library: https://github.com/labfruits/mcp320x but an other doesn't work either.
    Connecting the same ADC to an arduino nano works fine.

  2. #2
    Observation: same code + electronics work fine on a teensy 4.0.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •