9 years, 5 months ago.

PWM out for different location

I have currently created a target for the Gecko G800 STK and based it on one of the other targets to create the port. I am using the gecko startup/linker script source files from the Silabs peripheral libraries and have manage to get the LED and serial port working but I am having issue with the PWM output.

I am trying to set PD1 on the eval board but this is located in location 3. From reading the pwmout_api.c, it seems to be set to location 1 by default but there doesn't seem to be an api to set the location. Would this feature be added in the near future or I have I miss something out?

My code for setting up the pwm is shown below. I imagine by setting it, it will use the default period of 20ms.

pwmout for gecko board

#include "mbed.h"

PwmOut myPWM(PD1);

int main(void)
{
    while (1) {
    }
}

My linker script change for the gecko board is shown below and copied all the efm32g source and header from the peripheral libs to the cmsis target folder. I have copied the cmsis files from STK3700 and made the change to the number of vectors; #define NVIC_NUM_VECTORS (16 + 30) . Is there anything that I may have missed out?

linked script change

/* MBED: mbed needs to be able to dynamically set the interrupt vector table.
 * We make room for the table at the very beginning of RAM, i.e. at
 * 0x20000000. We need (16+30) * sizeof(uint32_t) = 184 bytes for EFM32G */
__vector_size = 0xBC;

...
...

__data_start__ = .;
    *("dma")
    PROVIDE( __start_vector_table__ = .);
    . += __vector_size;
    PROVIDE( __end_vector_table__ = .);
    *(vtable)
    *(.data*)
    . = ALIGN (4);
    *(.ram)

posted by Paul Lee 14 Jun 2015

I fork the mbed repo and added the new target. https://github.com/ubergeekNZ/mbed

posted by Paul Lee 15 Jun 2015

Ok figure out where it is set.

posted by Paul Lee 15 Jun 2015
Be the first to answer this question.