RC Radio PWM signal, problems reading
Hi,
Im trying to resurrect this project from 2015 (Software AWD control for RC Cards using 4x brushless motors):
https://github.com/hammerfet/BrinirController
Ive built his VS2013 solution and got all that side working fine. However, next is to determine I can read the RC Radio signal (standard RC drone Turnigy 9x and FRSky V8FR-II receiver) and Im getting problems. The signals are just two, throttle and steering and connected to PA0 and PA1 on a STM32 F407 discovery.
Sometimes it doesnt read anything, sometimes it reads it once occasionally it reads everything fine.
Here is the IO code:
/* TIM2 Init - PPM Inputs */
htim2.Instance = TIM2;
htim2.Init.Prescaler = PPMMEASUREPRESCALER;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 65535;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_Base_Init(&htim2);
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
HAL_TIM_Base_Start_IT(&htim2);
and some more references in config.h:
#define PPMMEASUREPRESCALER 4
#define RECEIVERMINSIGNAL 500
#define RECEIVERMIDSIGNAL 25000
#define RECEIVERMAXSIGNAL 34000
Is there anything obviously wrong here? Anything I should know about connecting RC Radio PWM to the F407?
