board_config.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. * @file board_config.h
  3. * @author Xiao Lifan (xiaolf6@midea.com)
  4. * @brief 硬件相关参数配置
  5. * @version 0.1
  6. * @date 2023-05-06
  7. *
  8. * @copyright Copyright (c) 2023
  9. *
  10. */
  11. /* ========================================================================== */
  12. /* ================================= 采样范围配置 ================================= */
  13. /* ========================================================================== */
  14. #define HW_VBUS_MEASMAX_V 6419 /**< Vdc measure max 424.6(0.1V) */
  15. #define HW_VAC_MEASMAX_V 4950 /**< Vac measure max 495.0(0.1V) */
  16. #define HW_VPHASE_MEASMAX_V 4290 /**< Terminal Voltage measure max 429.0(0.1V) */
  17. #define HW_I_MEASMAX_A 825 /**< Current measure max(peak2peak) (0.01A) */
  18. /* ========================================================================== */
  19. /* ================================= 硬件参数配置 ================================= */
  20. /* ========================================================================== */
  21. /* ---------------------------------- 系统RAM --------------------------------- */
  22. #define HW_RAM_START_ADDRESS 0x20001fffUL
  23. #define HW_RAM_END_ADDRESS 0x20001fffUL
  24. /* ---------------------------------- 系统时钟 ---------------------------------- */
  25. #define HW_MCU_CLOCK_HZ 64000000UL
  26. /* --------------------------------- 电力系统参数 --------------------------------- */
  27. #define HW_UAC_FREQ_HZ 50
  28. /* --------------------------------- PWM频率配置 -------------------------------- */
  29. #define HW_TIM_CLOCK_HZ 64000000UL
  30. #define HW_TIM_CLOCK_MHZ (HW_TIM_CLOCK_HZ / 1000000UL)
  31. #define HW_INIT_FPWM_HZ 8000
  32. #define HW_INIT_FTBC_TICK 1
  33. #define HW_INIT_FTBS_TICK 4
  34. #define HW_INIT_FTBC_HZ (HW_INIT_FPWM_HZ / HW_INIT_FTBC_TICK)
  35. #define HW_INIT_FTBS_HZ (HW_INIT_FPWM_HZ / HW_INIT_FTBS_TICK)
  36. #define HW_INIT_PWM_PERIOD (HW_TIM_CLOCK_HZ / HW_INIT_FPWM_HZ)
  37. #define HW_INIT_HPWM_PERIOD (HW_INIT_PWM_PERIOD >> 1)
  38. #define HW_INIT_HHPWM_PERIOD (HW_INIT_PWM_PERIOD >> 2)
  39. #define HW_INIT_HHHPWM_PERIOD (HW_INIT_PWM_PERIOD >> 3)
  40. /* --------------------------------- PWM死区参数 -------------------------------- */
  41. #define HW_DEADBAND_TIME HW_TIM_CLOCK_MHZ /**< 死区时间,单位: 时钟Tick */
  42. /* ---------------------------------- adc参数 --------------------------------- */
  43. #define HW_SAMPLE_BEFORE_UPDATE_CNTS 100 /**< 采样相对于PWM顶底点提前的周期数,单位: 时钟Tick */
  44. /* ---------------------------------- 充电继电器 --------------------------------- */
  45. #define HW_RLY_VOL_V 1600 /**< 母线充电限值电压,单位: 0.1V */
  46. #define HW_RLY_VOL_MS 1000 /**< 母线充时间,单位: MS */
  47. #define HW_RLYON_OVER_MS 200
  48. /* ---------------------------------- 输入捕获 ---------------------------------- */
  49. #define HW_PWM_CAP_HZ 1600000L
  50. /* ========================================================================== */
  51. /* ================================ API接口序号定义 =============================== */
  52. /* ========================================================================== */
  53. #define HW_TBS_TIMER 0
  54. #define HW_SYSTICK_TIMER 1
  55. #define TBS_TIMER 0
  56. #define SYSTICK_TIMER 1
  57. #define HW_ADC_IA_CH 0
  58. #define HW_ADC_IB_CH 1
  59. #define HW_ADC_IC_CH 2
  60. #define HW_ADC_IDC_CH 0
  61. #define HW_ADC_UDC_CH 0
  62. #define HW_ADC_U6V_CH 1
  63. #define HW_ADC_U5V_CH 2
  64. #define HW_ADC_PCBTEMP_CH 3
  65. #define HW_ADC_MOTTEMP_CH 4
  66. #define HW_ADC_U12V_CH 5
  67. #define HW_ADC_THRO_CH 6
  68. #define HW_ADC_TORQ_CH 7
  69. #define HW_GPIO_LED_PIN 0
  70. #define HW_GPIO_CAP_PIN 1
  71. #define HW_GPIO_TX_PIN 0
  72. #define HW_GPIO_RX_PIN 1
  73. #define HW_ADC_IBUS_1ST_CH 0
  74. #define HW_ADC_IBUS_2ND_CH 1
  75. #define HW_ADC_SP_CHANNEL 0
  76. #define HW_ADC_TEMP_CHANNEL 1
  77. #define HW_ADC_IU_CHANNEL 2
  78. #define HW_ADC_IV_CHANNEL 3
  79. #define HW_ADC_UDC_CHANNEL 4
  80. #define HW_ADC_UW_CHANNEL 5
  81. #define HW_ADC_UV_CHANNEL 6
  82. #define HW_ADC_UU_CHANNEL 7
  83. /* Api Device Index Definations */