Solved
How to add PWM control in SPC58EC-DISP using Ethernet gateway
Hello!
I have a SPC58EC-DISP and imported a sample application: Network Gateway Test; I added PWM control, but it keeps running PWM and cannot run the network gateway, what should I do? it used FreeRTOS.
/* eMIOS1 CH22 (PWM, GROUP2) period callback.*/
void emios1_gr2ch22_pcb(PWMDriver *pwmp) {
(void)pwmp;
}
/* eMIOS1 CH22 (PWM, GROUP2) period callback.*/
void emios1_gr2ch22_cb(PWMDriver *pwmp) {
(void)pwmp;
}
portTASK_FUNCTION(motorPwmTask, pvParam ) {
(void)pvParam;
pwm_lld_start(&PWMD14,&pwm_config_e1_gr2_pwmcfg);
for( ; ; ){
pwm_lld_enable_channel(&PWMD14, 5, PWM_PERCENTAGE_TO_WIDTH(&PWMD14, 5000), 100, 0, 0);
}
}
uint32_t motor_pwm_start(void) {
uint32_t ret;
/* create motor pwm task */
ret = xTaskCreate(motorPwmTask, "motorPwmTask", 1024, NULL, 6, NULL);
return (ret == pdPASS) ? 0 : 1;
}
/*
* Application entry point.
*/
int main(void) {
uint32_t error;
/* Initialization of all the imported components in the order specified in
the application wizard. The function is generated automatically.*/
componentsInit();
/* Enable Interrupts */
irqIsrEnable();
encoder_setup();
/* Start the motor pwm task */
error = motor_pwm_start();
/* Start the gateway task */
error = gateway_start();
if (!error) {
/* Start the remote device emulation task */
error = remote_start();
}
if (!error) {
/* Start all tasks */
vTaskStartScheduler();
}
/* If all is well, the scheduler will now be running, and the following
line will never be reached. If the following line does execute, then
there was insufficient FreeRTOS heap memory available for the idle and/or
timer tasks to be created. See the memory management section on the
FreeRTOS web site for more details. http://www.freertos.org/a00111.html */
for( ;; ) {}
return 0;
}
