Open kissste opened 7 years ago
Debugging:
It's somewhere inside hal_pinmux.c
unfortunately, no source code.
It appears to be checking something in the RAM in HALEFUSEOneByteReadRAM
unfortunately, no source code.
Dead-end
gbd: 51 if (_FALSE == FunctionChk((pPwmAdapt->pwm_id+PWM0), pPwmAdapt->sel)) { (gdb) s FunctionChk (Function=Function@entry=162, PinLocation=PinLocation@entry=1) at ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c:164 164 ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c: No such file or directory. (gdb) l 159 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) l 159 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s 162 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s 164 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s HALEFUSEOneByteReadRAM (CtrlSetting=3492870396, Addr=Addr@entry=248, Data=Data@entry="", L25OutVoltage=L25OutVoltage@entry=7 '\a') at ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_efuse.c:286 286 ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_efuse.c: No such file or directory. (gdb) s 290 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_efuse.c (gdb) s 294 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_efuse.c (gdb) s FunctionChk (Function=Function@entry=162, PinLocation=PinLocation@entry=1) at ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c:168 168 ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c: No such file or directory. (gdb) s 185 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s FunctionChk (Function=162, PinLocation=1) at ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c:168 168 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s RTL8710afFunChk (Function=Function@entry=162, PinLocation=PinLocation@entry=1) at ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c:95 95 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s 153 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s 156 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c (gdb) s HAL_Pwm_Init (pPwmAdapt=pPwmAdapt@entry=, pwm_id=pwm_id@entry=2, sel=sel@entry=1) at ../../../component/soc/realtek/8195a/fwlib/src/hal_pwm.c:52 52 return HAL_ERR_HW;
I have managed to get PWM working by disabling the following check that is in the SDK:
./component/soc/realtek/8195a/fwlib/src/hal_pwm.c
if (_FALSE == FunctionChk((pPwmAdapt->pwm_id+PWM0), pPwmAdapt->sel)) { //return HAL_ERR_HW; }
This FunctionChk goes somewhere in the RAM and then determines that there is on PWM available. 164 in ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_pinmux.c calls HALEFUSEOneByteReadRAM (CtrlSetting=3492870396, Addr=Addr@entry=248, Data=Data@entry="", L25OutVoltage=L25OutVoltage@entry=7 '\a') at ../../../component/soc/realtek/8195a/fwlib/ram_lib/hal_efuse.c:286
Once you disable this check, the PWM works like a charm.
RTLDUINO_RTL8710AF_GCC/project/realtek_ameba1_va0_example/example_sources/pwm/src/main.c
does not work on RTL8710.
I'm getting: [PWM Err]pwmout_init Err! [PWM Err]pwmout_init Err! [PWM Err]pwmout_init Err! [PWM Err]pwmout_init Err!
Must be from this loop: for (i=0; i<4; i++) { pwmout_init(&pwm_led[i], pwm_led_pin[i]); pwmout_period_us(&pwm_led[i], PWM_PERIOD); }
I wonder whether RTL8710 even supports PWM (on these pins, PC_0,1,2 and 3)
Deeper:
It might be a mbed/HAL integration issue.