7 years, 4 months ago.

AnalogOut problem on SiLabs Perl Gecko

Dear Developers, I've spent quiet a lot time searching any solution to this problem. I've found the the very same "general" code works flawlessly on LPC1768, but can not work (even don't compile) to SiLab EFM32 Pearl Gecko. I alwas get the same error: Identifier "AnalogOut" is undefined in "main.cpp", Line: 6, Col: 2

AnalogOut Sine Output

//sine

#include "mbed.h"
 
//lpc1768 AnalogOut aout(p18);
AnalogOut aout(PB13); // Gecko
 
int main()
{
    const double pi = 3.141592653589793238462;
    const double amplitude = 0.5f;
    const double offset = 65535/2;
    double rads = 0.0;
    uint16_t sample = 0;
    
    while(1) {
        // sinewave output
        for (int i = 0; i < 360; i++) {
            rads = (pi * i) / 180.0f;
            sample = (uint16_t)(amplitude * (offset * (cos(rads + pi))) + offset);
            aout.write_u16(sample);
        }
    }
}

I've found the this problem is very common when someone tries to write analogue data to a pin on a MCU without a DAC. Pearl Gecko has a sophisticated analogue part, including 12 bit DAC. I've also tried to export the software to use with Silabs off-line development environment (Simplicity Studio), but this attemt also failed (compile error).

As far as I can find, the source of the problem is that AnalogOut isn't implemented in EFM32 environment.

Any hint or suggestion are welcome!

Thanks in advance,

Tamás

1 Answer

7 years, 4 months ago.

It will be fine as it is. our platform with uVisor 11.3 (Stable) from feren OS the CPLDs, Hello worlds ??