RasPI Pico with mag-sensor PWM compile errors [solved]

Hi, I try to compile a mag sensor in PWM mode and a motor in velocity control (no current sensor) but I get weird error messages about the commander line and current sense stuff.

I can compile it for ESP32 dev module without errors…

Maybe I messed up my rp2040 libraries? Because I had mbed lib before, then removed it and installed philhowers lib.

warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   68 |      command.add('T', doTarget, "target velocity");
      |                                 ^~~~~~~~~~~~~~~~~
c:\Users\USER\Documents\Arduino\libraries\Simple_FOC\src\current_sense\hardware_specific\rp2040\rp2040_mcu.cpp:18:44: error: 'ADC_CS_START_ONCE_BITS' was not declared in this scope
   18 | alignas(32) const uint32_t trigger_value = ADC_CS_START_ONCE_BITS; // start once
      |                                            ^~~~~~~~~~~~~~~~~~~~~~

I re-installed the mbed library and searched fro “mbed” boards in the board selector.
If I search for “rp2040”, I get all the phillhower-supported boards.

Now it compiles without problems. :sweat_smile:

1 Like

After playing with the PWM-sensor the whole day, i can state, that the blocking mode runs smoother on the RasPi pico.
But even when it works OK, the example sketch “find_min_max PWM” had a problem at the turning point from 2PI to 0.
Finding minPWM was stable, but the maxPWM sometimes showed extreme high values.
They seemed to be multiples of the real max-value, like the algorithm missed the falling slope interrupt and counted two or more pulses.