MCP4275 Adafruit sinewave.ino not working on STM32F103C8T6

hi,

I am using Arduino IDE 1.18.3, from the Adafruit MCP4725 sinewave.ino sample source code, where I modified a bit the setup() as shown below:


void setup (void) 
{
    Serial.begin(9600);
    while( !Serial ) {};     
    Serial.println("Hello!");

    // For Adafruit MCP4725A1 the address is 0x62 (default) or 0x63 (ADDR pin tied to VCC)
    // For MCP4725A0 the address is 0x60 or 0x61
    // For MCP4725A2 the address is 0x64 or 0x65
    Serial.print( "\nInitializing DAC..." );    
    bool bres = dac.begin( 0x60 );
    if( bres )
       Serial.print( "OK" );
    else
    {
       Serial.print( "ERROR" );
       while( 1 ){};
    }
    Serial.println("\nGenerating a sine wave");
}

When it is tested under STM32F103C8T6, it is able to find I2C at 0x60, but the output from MCP4275 is static at 2.000xV, it is not showing any sine wave and the compile is fine.

The code is compiled under attributes below:

Here is the snapshot of the current result:

The bootloader is using \STM32duino-bootloader-master\binaries\naze32_boot20.bin

However, the same code tested OK under Arduino Nano chip.

Personally, I don't really want to dive into raw ARM coding, under Arduino C/C++ language will do.

Any suggestion is appreciated.

Please advise.

Post your entire sketch, and circuit.

Thanks, I resolved using the "Wire" solution, the source is from the sketch samples of the Arduino IDE, "Examples->Adafruit MCP4725->sinewave" with minor modification as shown on the first photo above, the source inside the second photo is not related, just to show the STM32 options set, nothing special.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.