We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Sorry guys, I am just starting out on this IDE when MBED struggled to run Ticker and Uart together :(
after the export, the build shows this error : .\build\Nucleo_printf3.axf: error: L6002U: Could not open file mbed/TARGET_NUCLEO_F072RB/TOOLCHAIN_ARM_MICRO/stm32f0xx_hal_sp: No such file or directory
I checked the MBED and uV project folders, the file does not exist anywhere.
the project is attempting to use UART, Ticker, DAC
#include "mbed.h" Ticker toggle_led_ticker; Serial pc(SERIAL_TX, SERIAL_RX); // 9600 bauds, 8-bit data, no parity //Serial pc(PA_2, PA_3); // MBED won't run true serial ports ?? regardless here, all // outputs through USB virtual comm ports AnalogOut my_output(PA_4); DigitalOut myled(LED1); #define PI (3.141592653589793238462) #define AMPLITUDE (1.0) // x * 3.3V #define PHASE (PI * 1) // 2*pi is one period #define RANGE (4096/2) // 12 bits DAC #define OFFSET (4096/2) // 12 bits DAC // Configuration for sinewave output #define BUFFER_SIZE (360) uint16_t buffer[BUFFER_SIZE]; void calculate_sinewave(void); void toggle_led(void); void Ramp_DAC(void); void Dac_Sine_wave(void); int Dac_Output =0; int Buffer_pointer =0; int main() { calculate_sinewave(); //// toggle_led_ticker.attach(&toggle_led, 0.000006); //this is also output on Pin PA5, DAC2 //5.75uSec update gives fastest sinewave = 173.913kHz //// toggle_led_ticker.attach(&Ramp_DAC, 0.000006); // toggle_led_ticker.attach(&Dac_Sine_wave, 0.000006);// this stops the UART functioning in MBED int i = 1; pc.printf("Hello World !\n"); while(1) { wait(0.1); pc.printf("Step %d\n", i++); myled = !myled; } } void toggle_led() { myled = !myled; } void Ramp_DAC(void) { Dac_Output = Dac_Output + 2000; //if(Dac_Output >4096) Dac_Output=0; if(Dac_Output >=3000) Dac_Output=0; my_output.write_u16(Dac_Output); // my_output2.write_u16(Dac_Output); } void Dac_Sine_wave(void) { Buffer_pointer ++; if (Buffer_pointer >359) { Buffer_pointer =0; toggle_led(); } my_output.write_u16(buffer[Buffer_pointer]); //my_output2.write_u16(buffer[Buffer_pointer]/2); } // Create the sinewave buffer void calculate_sinewave(void) { for (int i = 0; i < BUFFER_SIZE; i++) { double rads = (PI * i)/180.0; // Convert degree in radian buffer[i] = (uint16_t)(AMPLITUDE * (RANGE * (cos(rads + PHASE))) + OFFSET); } }
Just a quick information - please refer to: http://www.keil.com/appnotes/docs/apnt_207.asp