Thanks a lot for answering so fast. But all the code I have using servos doesn't work anymore, with or without PWM... And the code is very simple. With this code the axon appears to freeze and the display flickers. It all used to work fine can you tell me what is wrong please? I think it reset before even sending the printf and if I use the PWM it reset after sending it. I ruled out any hardware problem by changing the power supply and disconnecting the servos. Thanks
#include "sys/axon2.h"
#include "rprintf.h"
#include "hardware.h"
#include "servos.h"
#include "pwm.h"
SERVO servo0 = MAKE_SERVO(FALSE, E3,1000, 500);
SERVO servo1 = MAKE_SERVO(FALSE, E4,1000, 500);
SERVO servo2 = MAKE_SERVO(FALSE, E5,1000, 500);
SERVO_LIST servos[] = {&servo0,&servo1,&servo2};
SERVO_DRIVER bank1 = MAKE_SERVO_DRIVER(servos);
void appInitHardware(void){
servosInit(&bank1, TIMER1);
// servoPWMInit(&bank1);
uartInit(USB_UART, USB_BAUD);
rprintfInit(USB_ACTIVATE);
}
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
rprintf("\nAxon initiated.\n\n");
servosSetConnected(&bank1,TRUE);
return 0;
}
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
statusLED_off();
servosCenter(servos, USB_UART);
statusLED_on();
return 2000;
}