[射频芯片] 求SI4438的驱动

[复制链接]
11378|18
 楼主| 木头0 发表于 2015-5-8 16:32 | 显示全部楼层 |阅读模式
本帖最后由 木头0 于 2015-5-8 21:24 编辑

    小弟最近在做msp430的相关课题,要用到无线收发功能,得用si4438,手上有一份SI4438的驱动,可实现无线模块的收发,但是小弟要用到SI4438的RSSI,可惜小弟才疏学浅,写不出获取SI4438的RSSI的函数。之前在网上找过一些函数,但读到的RSSI总是0。希望有大神能帮忙写个读取RSSI的函数,或者提供一份带读取RSSI的SI4438驱动。(驱动要是代码可见的)
 楼主| 木头0 发表于 2015-5-8 20:19 | 显示全部楼层
本帖最后由 木头0 于 2015-5-8 22:14 编辑

RF接收函数
  1. //RF接收函数
  2. U8 rf_get_data(U8 * buf, U8 maxlen)
  3. {
  4.     if ( radio_hal_NirqLevel() ) return 0;

  5.     /* Read ITs, clear pending ones */
  6.     si446x_get_int_status(0u, 0u, 0u);

  7.     /* check the reason for the IT */

  8.     if (Si446xCmd.GET_INT_STATUS.MODEM_PEND & SI446X_CMD_GET_INT_STATUS_REP_SYNC_DETECT_BIT)
  9.     {
  10.         /* Sync Word detected */
  11.         // Disabled in the project
  12.     }

  13.     if (Si446xCmd.GET_INT_STATUS.PH_PEND & SI446X_CMD_GET_INT_STATUS_REP_PACKET_RX_PEND_BIT)
  14.     {
  15.         /* CRC OK or not enabled */

  16.         /* Read the length of RX_FIFO */
  17.         si446x_fifo_info(0u);
  18.         maxlen = Si446xCmd.FIFO_INFO.RX_FIFO_COUNT < maxlen ?
  19.                  Si446xCmd.FIFO_INFO.RX_FIFO_COUNT : maxlen ;

  20.         /* Packet RX */
  21.         si446x_read_rx_fifo(maxlen , buf);

  22.         /* clear the tx & rx fifo */
  23.         si446x_fifo_info(0x03);

  24.         return maxlen;
  25.     }

  26.     if (Si446xCmd.GET_INT_STATUS.PH_PEND & SI446X_CMD_GET_INT_STATUS_REP_CRC_ERROR_BIT)
  27.     {
  28.         /* Reset tx & rx FIFO */
  29.         si446x_fifo_info( 0x03 );
  30.     }

  31.     return 0;
  32. }



附上在网上找的读取rssi的代码,读取后总是0

  1. //**************************************************************************************************************
  2. // 名    称:unsigned int   App_Read_Rssi_temp(void);
  3. // 函数描述:读接收到的RSSI
  4. // 输入参数:无
  5. // 输出参数:是否读取成功,正确读取,就是读取成功,否则为读取不成功
  6. // 注    意:
  7. //**************************************************************************************************************
  8. signed int  App_Read_Rssi_temp(void)
  9. {
  10.     signed int temp;
  11.     si446x_get_modem_status(0x18);
  12.     temp = Si446xCmd.GET_MODEM_STATUS.CURR_RSSI;
  13.     return(temp);
  14. }
minton123 发表于 2015-5-11 14:13 | 显示全部楼层
我是这样读取RSSI的值,先用WDS软件设设置好在哪里读取RSSI的值。比如收到同步字之后,然后把这个RSSI的值放到快速寄存器A里面去,在然后在收到同步字的程序上面读取快速寄存器A的值就行了。
 楼主| 木头0 发表于 2015-5-11 20:03 | 显示全部楼层
minton123 发表于 2015-5-11 14:13
我是这样读取RSSI的值,先用WDS软件设设置好在哪里读取RSSI的值。比如收到同步字之后,然后把这个RSSI的值放 ...

后来我发现我的寄存器配置文件没有对RSSI进行锁存,我就用WDS软件自己写了给配置文件,但是程序经常卡住接收程序里,等好久才能完成接收,而且RSSI测出来也很小(经过公式变换后),而且之后rssi就不变了。本人不是通信专业的,对通信和无线模块完全不懂,WDS软件的那些配置项,根本不知道什么意思。


并附上我之前用的驱动的配置文件(可以很好的收发,但没RSSI)
  1. /*! @file radio_config.h
  2. * @brief This file contains the automatically generated
  3. * configurations.
  4. *
  5. * @n WDS GUI Version: 3.2.7.0
  6. * @n Device: Si4438 Rev.: B1                                 
  7. *
  8. * @b COPYRIGHT
  9. * @n Silicon Laboratories Confidential
  10. * @n Copyright 2014 Silicon Laboratories, Inc.
  11. * @
  12. */

  13. #ifndef RADIO_CONFIG_H_
  14. #define RADIO_CONFIG_H_

  15. // USER DEFINED PARAMETERS
  16. // Define your own parameters here

  17. // INPUT DATA
  18. /*
  19. // Crys_freq(Hz): 30000000    Crys_tol(ppm): 20    IF_mode: 2    High_perf_Ch_Fil: 1    OSRtune: 0    Ch_Fil_Bw_AFC: 0    ANT_DIV: 0    PM_pattern: 0   
  20. // MOD_type: 3    Rsymb(sps): 45000    Fdev(Hz): 33750    RXBW(Hz): 150000    Manchester: 0    AFC_en: 0    Rsymb_error: 0.0    Chip-Version: 2   
  21. // RF Freq.(MHz): 434.2    API_TC: 31    fhst: 250000    inputBW: 0    BERT: 0    RAW_dout: 0    D_source: 0    Hi_pfm_div: 1   
  22. //
  23. // # WB filter 1 (BW = 114.46 kHz);  NB-filter 1 (BW = 114.46 kHz)  //
  24. // Modulation index: 1.5
  25. */


  26. // CONFIGURATION PARAMETERS
  27. #define RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ                     30000000L
  28. #define RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER                    0x00
  29. #define RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH               0x02
  30. #define RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP        0x03
  31. #define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET       0xF000
  32. #define RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD                    {0xC5, 0xC5}


  33. // CONFIGURATION COMMANDS

  34. /*
  35. // Command:                  RF_POWER_UP
  36. // Description:              Command to power-up the device and select the operational mode and functionality.
  37. */
  38. #define RF_POWER_UP 0x02, 0x01, 0x00, 0x01, 0xC9, 0xC3, 0x80

  39. /*
  40. // Command:                  RF_GPIO_PIN_CFG
  41. // Description:              Configures the GPIO pins.
  42. */
  43. #define RF_GPIO_PIN_CFG 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

  44. /*
  45. // Set properties:           RF_GLOBAL_XO_TUNE_1
  46. // Number of properties:     1
  47. // Group ID:                 0x00
  48. // Start ID:                 0x00
  49. // Default values:           0x40,
  50. // Descriptions:
  51. //   GLOBAL_XO_TUNE - Configure the internal capacitor frequency tuning bank for the crystal oscillator.
  52. */
  53. #define RF_GLOBAL_XO_TUNE_1 0x11, 0x00, 0x01, 0x00, 0x52

  54. /*
  55. // Set properties:           RF_GLOBAL_CONFIG_1
  56. // Number of properties:     1
  57. // Group ID:                 0x00
  58. // Start ID:                 0x03
  59. // Default values:           0x20,
  60. // Descriptions:
  61. //   GLOBAL_CONFIG - Global configuration settings.
  62. */
  63. #define RF_GLOBAL_CONFIG_1 0x11, 0x00, 0x01, 0x03, 0x60

  64. /*
  65. // Set properties:           RF_MODEM_MOD_TYPE_12
  66. // Number of properties:     12
  67. // Group ID:                 0x20
  68. // Start ID:                 0x00
  69. // Default values:           0x02, 0x80, 0x07, 0x0F, 0x42, 0x40, 0x01, 0xC9, 0xC3, 0x80, 0x00, 0x06,
  70. // Descriptions:
  71. //   MODEM_MOD_TYPE - Selects the type of modulation. In TX mode, additionally selects the source of the modulation.
  72. //   MODEM_MAP_CONTROL - Controls polarity and mapping of transmit and receive bits.
  73. //   MODEM_DSM_CTRL - Miscellaneous control bits for the Delta-Sigma Modulator (DSM) in the PLL Synthesizer.
  74. //   MODEM_DATA_RATE_2 - Unsigned 24-bit value used to determine the TX data rate
  75. //   MODEM_DATA_RATE_1 - Unsigned 24-bit value used to determine the TX data rate
  76. //   MODEM_DATA_RATE_0 - Unsigned 24-bit value used to determine the TX data rate
  77. //   MODEM_TX_NCO_MODE_3 - TX Gaussian filter oversampling ratio and Byte 3 of unsigned 26-bit TX Numerically Controlled Oscillator (NCO) modulus.
  78. //   MODEM_TX_NCO_MODE_2 - TX Gaussian filter oversampling ratio and Byte 3 of unsigned 26-bit TX Numerically Controlled Oscillator (NCO) modulus.
  79. //   MODEM_TX_NCO_MODE_1 - TX Gaussian filter oversampling ratio and Byte 3 of unsigned 26-bit TX Numerically Controlled Oscillator (NCO) modulus.
  80. //   MODEM_TX_NCO_MODE_0 - TX Gaussian filter oversampling ratio and Byte 3 of unsigned 26-bit TX Numerically Controlled Oscillator (NCO) modulus.
  81. //   MODEM_FREQ_DEV_2 - 17-bit unsigned TX frequency deviation word.
  82. //   MODEM_FREQ_DEV_1 - 17-bit unsigned TX frequency deviation word.
  83. */
  84. #define RF_MODEM_MOD_TYPE_12 0x11, 0x20, 0x0C, 0x00, 0x03, 0x00, 0x07, 0x02, 0x71, 0x00, 0x05, 0xC9, 0xC3, 0x80, 0x00, 0x00

  85. /*
  86. // Set properties:           RF_MODEM_FREQ_DEV_0_1
  87. // Number of properties:     1
  88. // Group ID:                 0x20
  89. // Start ID:                 0x0C
  90. // Default values:           0xD3,
  91. // Descriptions:
  92. //   MODEM_FREQ_DEV_0 - 17-bit unsigned TX frequency deviation word.
  93. */
  94. #define RF_MODEM_FREQ_DEV_0_1 0x11, 0x20, 0x01, 0x0C, 0x46

  95. /*
  96. // Set properties:           RF_MODEM_TX_RAMP_DELAY_8
  97. // Number of properties:     8
  98. // Group ID:                 0x20
  99. // Start ID:                 0x18
  100. // Default values:           0x01, 0x00, 0x08, 0x03, 0xC0, 0x00, 0x10, 0x20,
  101. // Descriptions:
  102. //   MODEM_TX_RAMP_DELAY - TX ramp-down delay setting.
  103. //   MODEM_MDM_CTRL - MDM control.
  104. //   MODEM_IF_CONTROL - Selects Fixed-IF, Scaled-IF, or Zero-IF mode of RX Modem operation.
  105. //   MODEM_IF_FREQ_2 - the IF frequency setting (an 18-bit signed number).
  106. //   MODEM_IF_FREQ_1 - the IF frequency setting (an 18-bit signed number).
  107. //   MODEM_IF_FREQ_0 - the IF frequency setting (an 18-bit signed number).
  108. //   MODEM_DECIMATION_CFG1 - Specifies three decimator ratios for the Cascaded Integrator Comb (CIC) filter.
  109. //   MODEM_DECIMATION_CFG0 - Specifies miscellaneous parameters and decimator ratios for the Cascaded Integrator Comb (CIC) filter.
  110. */
  111. #define RF_MODEM_TX_RAMP_DELAY_8 0x11, 0x20, 0x08, 0x18, 0x01, 0x00, 0x08, 0x03, 0x80, 0x00, 0xB0, 0x10

  112. /*
  113. // Set properties:           RF_MODEM_BCR_OSR_1_9
  114. // Number of properties:     9
  115. // Group ID:                 0x20
  116. // Start ID:                 0x22
  117. // Default values:           0x00, 0x4B, 0x06, 0xD3, 0xA0, 0x06, 0xD3, 0x02, 0xC0,
  118. // Descriptions:
  119. //   MODEM_BCR_OSR_1 - RX BCR/Slicer oversampling rate (12-bit unsigned number).
  120. //   MODEM_BCR_OSR_0 - RX BCR/Slicer oversampling rate (12-bit unsigned number).
  121. //   MODEM_BCR_NCO_OFFSET_2 - RX BCR NCO offset value (an unsigned 22-bit number).
  122. //   MODEM_BCR_NCO_OFFSET_1 - RX BCR NCO offset value (an unsigned 22-bit number).
  123. //   MODEM_BCR_NCO_OFFSET_0 - RX BCR NCO offset value (an unsigned 22-bit number).
  124. //   MODEM_BCR_GAIN_1 - The unsigned 11-bit RX BCR loop gain value.
  125. //   MODEM_BCR_GAIN_0 - The unsigned 11-bit RX BCR loop gain value.
  126. //   MODEM_BCR_GEAR - RX BCR loop gear control.
  127. //   MODEM_BCR_MISC1 - Miscellaneous control bits for the RX BCR loop.
  128. */
  129. #define RF_MODEM_BCR_OSR_1_9 0x11, 0x20, 0x09, 0x22, 0x00, 0x4E, 0x06, 0x8D, 0xB9, 0x00, 0x00, 0x02, 0xC0

  130. /*
  131. // Set properties:           RF_MODEM_AFC_GEAR_7
  132. // Number of properties:     7
  133. // Group ID:                 0x20
  134. // Start ID:                 0x2C
  135. // Default values:           0x00, 0x23, 0x83, 0x69, 0x00, 0x40, 0xA0,
  136. // Descriptions:
  137. //   MODEM_AFC_GEAR - RX AFC loop gear control.
  138. //   MODEM_AFC_WAIT - RX AFC loop wait time control.
  139. //   MODEM_AFC_GAIN_1 - Sets the gain of the PLL-based AFC acquisition loop, and provides miscellaneous control bits for AFC functionality.
  140. //   MODEM_AFC_GAIN_0 - Sets the gain of the PLL-based AFC acquisition loop, and provides miscellaneous control bits for AFC functionality.
  141. //   MODEM_AFC_LIMITER_1 - Set the AFC limiter value.
  142. //   MODEM_AFC_LIMITER_0 - Set the AFC limiter value.
  143. //   MODEM_AFC_MISC - Specifies miscellaneous AFC control bits.
  144. */
  145. #define RF_MODEM_AFC_GEAR_7 0x11, 0x20, 0x07, 0x2C, 0x00, 0x12, 0x00, 0x23, 0x01, 0x5C, 0xA0

  146. /*
  147. // Set properties:           RF_MODEM_AGC_CONTROL_1
  148. // Number of properties:     1
  149. // Group ID:                 0x20
  150. // Start ID:                 0x35
  151. // Default values:           0xE0,
  152. // Descriptions:
  153. //   MODEM_AGC_CONTROL - Miscellaneous control bits for the Automatic Gain Control (AGC) function in the RX Chain.
  154. */
  155. #define RF_MODEM_AGC_CONTROL_1 0x11, 0x20, 0x01, 0x35, 0xE2

  156. /*
  157. // Set properties:           RF_MODEM_AGC_WINDOW_SIZE_3
  158. // Number of properties:     3
  159. // Group ID:                 0x20
  160. // Start ID:                 0x38
  161. // Default values:           0x11, 0x10, 0x10,
  162. // Descriptions:
  163. //   MODEM_AGC_WINDOW_SIZE - Specifies the size of the measurement and settling windows for the AGC algorithm.
  164. //   MODEM_AGC_RFPD_DECAY - Sets the decay time of the RF peak detectors.
  165. //   MODEM_AGC_IFPD_DECAY - Sets the decay time of the IF peak detectors.
  166. */
  167. #define RF_MODEM_AGC_WINDOW_SIZE_3 0x11, 0x20, 0x03, 0x38, 0x11, 0x11, 0x11

  168. /*
  169. // Set properties:           RF_MODEM_OOK_PDTC_1
  170. // Number of properties:     1
  171. // Group ID:                 0x20
  172. // Start ID:                 0x40
  173. // Default values:           0x2B,
  174. // Descriptions:
  175. //   MODEM_OOK_PDTC - Configures the attack and decay times of the OOK Peak Detector.
  176. */
  177. #define RF_MODEM_OOK_PDTC_1 0x11, 0x20, 0x01, 0x40, 0x28
 楼主| 木头0 发表于 2015-5-11 20:08 | 显示全部楼层
最后了
  1. /*
  2. // Set properties:           RF_MODEM_CHFLT_RX2_CHFLT_COE7_7_0_12_1
  3. // Number of properties:     12
  4. // Group ID:                 0x21
  5. // Start ID:                 0x18
  6. // Default values:           0xB8, 0xDE, 0x05, 0x17, 0x16, 0x0C, 0x03, 0x00, 0x15, 0xFF, 0x00, 0x00,
  7. // Descriptions:
  8. //   MODEM_CHFLT_RX2_CHFLT_COE7_7_0 - Filter coefficients for the second set of RX filter coefficients.
  9. //   MODEM_CHFLT_RX2_CHFLT_COE6_7_0 - Filter coefficients for the second set of RX filter coefficients.
  10. //   MODEM_CHFLT_RX2_CHFLT_COE5_7_0 - Filter coefficients for the second set of RX filter coefficients.
  11. //   MODEM_CHFLT_RX2_CHFLT_COE4_7_0 - Filter coefficients for the second set of RX filter coefficients.
  12. //   MODEM_CHFLT_RX2_CHFLT_COE3_7_0 - Filter coefficients for the second set of RX filter coefficients.
  13. //   MODEM_CHFLT_RX2_CHFLT_COE2_7_0 - Filter coefficients for the second set of RX filter coefficients.
  14. //   MODEM_CHFLT_RX2_CHFLT_COE1_7_0 - Filter coefficients for the second set of RX filter coefficients.
  15. //   MODEM_CHFLT_RX2_CHFLT_COE0_7_0 - Filter coefficients for the second set of RX filter coefficients.
  16. //   MODEM_CHFLT_RX2_CHFLT_COEM0 - Filter coefficients for the second set of RX filter coefficients.
  17. //   MODEM_CHFLT_RX2_CHFLT_COEM1 - Filter coefficients for the second set of RX filter coefficients.
  18. //   MODEM_CHFLT_RX2_CHFLT_COEM2 - Filter coefficients for the second set of RX filter coefficients.
  19. //   MODEM_CHFLT_RX2_CHFLT_COEM3 - Filter coefficients for the second set of RX filter coefficients.
  20. */
  21. #define RF_MODEM_CHFLT_RX2_CHFLT_COE7_7_0_12_1 0x11, 0x21, 0x0C, 0x18, 0xC9, 0xFC, 0x1B, 0x1E, 0x0F, 0x01, 0xFC, 0xFD, 0x15, 0xFF, 0x00, 0x0F

  22. /*
  23. // Set properties:           RF_PA_TC_1_1
  24. // Number of properties:     1
  25. // Group ID:                 0x22
  26. // Start ID:                 0x03
  27. // Default values:           0x5D,
  28. // Descriptions:
  29. //   PA_TC - Configuration of PA ramping parameters.
  30. */
  31. #define RF_PA_TC_1_1 0x11, 0x22, 0x01, 0x03, 0x3F

  32. /*
  33. // Set properties:           RF_SYNTH_PFDCP_CPFF_7_1
  34. // Number of properties:     7
  35. // Group ID:                 0x23
  36. // Start ID:                 0x00
  37. // Default values:           0x2C, 0x0E, 0x0B, 0x04, 0x0C, 0x73, 0x03,
  38. // Descriptions:
  39. //   SYNTH_PFDCP_CPFF - Feed forward charge pump current selection.
  40. //   SYNTH_PFDCP_CPINT - Integration charge pump current selection.
  41. //   SYNTH_VCO_KV - Gain scaling factors (Kv) for the VCO tuning varactors on both the integrated-path and feed forward path.
  42. //   SYNTH_LPFILT3 - Value of resistor R2 in feed-forward path of loop filter.
  43. //   SYNTH_LPFILT2 - Value of capacitor C2 in feed-forward path of loop filter.
  44. //   SYNTH_LPFILT1 - Value of capacitors C1 and C3 in feed-forward path of loop filter.
  45. //   SYNTH_LPFILT0 - Bias current of the active amplifier in the feed-forward loop filter.
  46. */
  47. #define RF_SYNTH_PFDCP_CPFF_7_1 0x11, 0x23, 0x07, 0x00, 0x2C, 0x0E, 0x0B, 0x04, 0x0C, 0x73, 0x03

  48. /*
  49. // Set properties:           RF_MATCH_VALUE_1_12
  50. // Number of properties:     12
  51. // Group ID:                 0x30
  52. // Start ID:                 0x00
  53. // Default values:           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  54. // Descriptions:
  55. //   MATCH_VALUE_1 - Match value to be compared with the result of logically AND-ing (bit-wise) the Mask 1 value with the received Match 1 byte.
  56. //   MATCH_MASK_1 - Mask value to be logically AND-ed (bit-wise) with the Match 1 byte.
  57. //   MATCH_CTRL_1 - Enable for Packet Match functionality, and configuration of Match Byte 1.
  58. //   MATCH_VALUE_2 - Match value to be compared with the result of logically AND-ing (bit-wise) the Mask 2 value with the received Match 2 byte.
  59. //   MATCH_MASK_2 - Mask value to be logically AND-ed (bit-wise) with the Match 2 byte.
  60. //   MATCH_CTRL_2 - Configuration of Match Byte 2.
  61. //   MATCH_VALUE_3 - Match value to be compared with the result of logically AND-ing (bit-wise) the Mask 3 value with the received Match 3 byte.
  62. //   MATCH_MASK_3 - Mask value to be logically AND-ed (bit-wise) with the Match 3 byte.
  63. //   MATCH_CTRL_3 - Configuration of Match Byte 3.
  64. //   MATCH_VALUE_4 - Match value to be compared with the result of logically AND-ing (bit-wise) the Mask 4 value with the received Match 4 byte.
  65. //   MATCH_MASK_4 - Mask value to be logically AND-ed (bit-wise) with the Match 4 byte.
  66. //   MATCH_CTRL_4 - Configuration of Match Byte 4.
  67. */
  68. #define RF_MATCH_VALUE_1_12 0x11, 0x30, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

  69. /*
  70. // Set properties:           RF_FREQ_CONTROL_INTE_8_1
  71. // Number of properties:     8
  72. // Group ID:                 0x40
  73. // Start ID:                 0x00
  74. // Default values:           0x3C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x20, 0xFF,
  75. // Descriptions:
  76. //   FREQ_CONTROL_INTE - Frac-N PLL Synthesizer integer divide number.
  77. //   FREQ_CONTROL_FRAC_2 - Frac-N PLL fraction number.
  78. //   FREQ_CONTROL_FRAC_1 - Frac-N PLL fraction number.
  79. //   FREQ_CONTROL_FRAC_0 - Frac-N PLL fraction number.
  80. //   FREQ_CONTROL_CHANNEL_STEP_SIZE_1 - EZ Frequency Programming channel step size.
  81. //   FREQ_CONTROL_CHANNEL_STEP_SIZE_0 - EZ Frequency Programming channel step size.
  82. //   FREQ_CONTROL_W_SIZE - Set window gating period (in number of crystal reference clock cycles) for counting VCO frequency during calibration.
  83. //   FREQ_CONTROL_VCOCNT_RX_ADJ - Adjust target count for VCO calibration in RX mode.
  84. */
  85. #define RF_FREQ_CONTROL_INTE_8_1 0x11, 0x40, 0x08, 0x00, 0x38, 0x0F, 0x25, 0x8B, 0x44, 0x44, 0x20, 0xFE


  86. // AUTOMATICALLY GENERATED CODE!
  87. // DO NOT EDIT/MODIFY BELOW THIS LINE!
  88. // --------------------------------------------

  89. #ifndef FIRMWARE_LOAD_COMPILE
  90. #define RADIO_CONFIGURATION_DATA_ARRAY { \
  91.         0x07, RF_POWER_UP, \
  92.         0x08, RF_GPIO_PIN_CFG, \
  93.         0x05, RF_GLOBAL_XO_TUNE_1, \
  94.         0x05, RF_GLOBAL_CONFIG_1, \
  95.         0x10, RF_MODEM_MOD_TYPE_12, \
  96.         0x05, RF_MODEM_FREQ_DEV_0_1, \
  97.         0x0C, RF_MODEM_TX_RAMP_DELAY_8, \
  98.         0x0D, RF_MODEM_BCR_OSR_1_9, \
  99.         0x0B, RF_MODEM_AFC_GEAR_7, \
  100.         0x05, RF_MODEM_AGC_CONTROL_1, \
  101.         0x07, RF_MODEM_AGC_WINDOW_SIZE_3, \
  102.         0x05, RF_MODEM_OOK_PDTC_1, \
  103.         0x0C, RF_MODEM_OOK_CNT1_8, \
  104.         0x05, RF_MODEM_RSSI_COMP_1, \
  105.         0x05, RF_MODEM_CLKGEN_BAND_1, \
  106.         0x10, RF_MODEM_CHFLT_RX1_CHFLT_COE13_7_0_12, \
  107.         0x10, RF_MODEM_CHFLT_RX1_CHFLT_COE1_7_0_12, \
  108.         0x10, RF_MODEM_CHFLT_RX2_CHFLT_COE7_7_0_12, \
  109.         0x05, RF_PA_TC_1, \
  110.         0x0B, RF_SYNTH_PFDCP_CPFF_7, \
  111.         0x0C, RF_FREQ_CONTROL_INTE_8, \
  112.         0x08, RF_START_RX, \
  113.         0x05, RF_GLOBAL_CLK_CFG_1, \
  114.         0x05, RF_GLOBAL_CONFIG_1_1, \
  115.         0x08, RF_INT_CTL_ENABLE_4, \
  116.         0x08, RF_FRR_CTL_A_MODE_4, \
  117.         0x0D, RF_PREAMBLE_TX_LENGTH_9, \
  118.         0x09, RF_SYNC_CONFIG_5, \
  119.         0x05, RF_PKT_CRC_CONFIG_1, \
  120.         0x08, RF_PKT_WHT_SEED_15_8_4, \
  121.         0x10, RF_PKT_LEN_12, \
  122.         0x10, RF_PKT_FIELD_2_CRC_CONFIG_12, \
  123.         0x10, RF_PKT_FIELD_5_CRC_CONFIG_12, \
  124.         0x0D, RF_PKT_RX_FIELD_3_CRC_CONFIG_9, \
  125.         0x10, RF_MODEM_MOD_TYPE_12_1, \
  126.         0x05, RF_MODEM_FREQ_DEV_0_1_1, \
  127.         0x0C, RF_MODEM_TX_RAMP_DELAY_8_1, \
  128.         0x0D, RF_MODEM_BCR_OSR_1_9_1, \
  129.         0x0B, RF_MODEM_AFC_GEAR_7_1, \
  130.         0x05, RF_MODEM_AGC_CONTROL_1_1, \
  131.         0x07, RF_MODEM_AGC_WINDOW_SIZE_3_1, \
  132.         0x05, RF_MODEM_OOK_PDTC_1_1, \
  133.         0x0D, RF_MODEM_OOK_CNT1_9, \
  134.         0x05, RF_MODEM_RSSI_CONTROL_1, \
  135.         0x05, RF_MODEM_RSSI_COMP_1_1, \
  136.         0x05, RF_MODEM_CLKGEN_BAND_1_1, \
  137.         0x10, RF_MODEM_CHFLT_RX1_CHFLT_COE13_7_0_12_1, \
  138.         0x10, RF_MODEM_CHFLT_RX1_CHFLT_COE1_7_0_12_1, \
  139.         0x10, RF_MODEM_CHFLT_RX2_CHFLT_COE7_7_0_12_1, \
  140.         0x05, RF_PA_TC_1_1, \
  141.         0x0B, RF_SYNTH_PFDCP_CPFF_7_1, \
  142.         0x10, RF_MATCH_VALUE_1_12, \
  143.         0x0C, RF_FREQ_CONTROL_INTE_8_1, \
  144.         0x00 \
  145. }
  146. #else
  147. #define RADIO_CONFIGURATION_DATA_ARRAY { 0 }
  148. #endif

  149. // DEFAULT VALUES FOR CONFIGURATION PARAMETERS
  150. #define RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ_DEFAULT                     30000000L
  151. #define RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER_DEFAULT                    0x00
  152. #define RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH_DEFAULT               0x10
  153. #define RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP_DEFAULT        0x01
  154. #define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET_DEFAULT       0x1000
  155. #define RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD_DEFAULT                                           {0x42, 0x55, 0x54, 0x54, 0x4F, 0x4E, 0x31} // BUTTON1

  156. #define RADIO_CONFIGURATION_DATA_RADIO_PATCH_INCLUDED                      0x00
  157. #define RADIO_CONFIGURATION_DATA_RADIO_PATCH_SIZE                          0x00
  158. #define RADIO_CONFIGURATION_DATA_RADIO_PATCH                               {  }

  159. #ifndef RADIO_CONFIGURATION_DATA_ARRAY
  160. #error "This property must be defined!"
  161. #endif

  162. #ifndef RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ
  163. #define RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ          RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ_DEFAULT
  164. #endif

  165. #ifndef RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER
  166. #define RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER         RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER_DEFAULT
  167. #endif

  168. #ifndef RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH
  169. #define RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH    RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH_DEFAULT
  170. #endif

  171. #ifndef RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP
  172. #define RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP   RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP_DEFAULT
  173. #endif

  174. #ifndef RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET
  175. #define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET  RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET_DEFAULT
  176. #endif

  177. #ifndef RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD
  178. #define RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD         RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD_DEFAULT
  179. #endif

  180. #define RADIO_CONFIGURATION_DATA { \
  181.                             Radio_Configuration_Data_Array,                            \
  182.                             RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER,                   \
  183.                             RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH,              \
  184.                             RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP,       \
  185.                             RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET,       \
  186.                             RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD                   \
  187.                             }

  188. #endif /* RADIO_CONFIG_H_ */
 楼主| 木头0 发表于 2015-5-11 21:33 | 显示全部楼层
minton123 发表于 2015-5-11 14:13
我是这样读取RSSI的值,先用WDS软件设设置好在哪里读取RSSI的值。比如收到同步字之后,然后把这个RSSI的值放 ...

刚刚测试了一下,并不是卡在接收程序里,而是被判断为接收不成功。所以丢包率很高。
minton123 发表于 2015-5-12 09:48 | 显示全部楼层
木头0 发表于 2015-5-11 21:33
刚刚测试了一下,并不是卡在接收程序里,而是被判断为接收不成功。所以丢包率很高。 ...

哪你这个SI4438的电路有没有电子开关的,就是有接收和发送用SI4438的GPIO口来回切换的,如果有,就要配置相应的存寄器。还有就是接收的跟发送的各种参数是否是相对应。可以开前导码中断,以及同步字中断来看接收否正常的。SI4438有B版本还有C版本的。会有不一样的配置的。看你上面用WDS生成的是B版的。通信的频点是否是一样的。SI4438的晶振是否30M。
 楼主| 木头0 发表于 2015-5-13 20:39 | 显示全部楼层
minton123 发表于 2015-5-12 09:48
哪你这个SI4438的电路有没有电子开关的,就是有接收和发送用SI4438的GPIO口来回切换的,如果有,就要配置 ...

  谢谢你的建议,后来我经过各种尝试后发现是WDS设置中,数据包设置与我所驱动不同,在数据包格式中使能数据包长度选项后,就可以正常收发了。
 楼主| 木头0 发表于 2015-5-13 20:58 | 显示全部楼层
    由于我用的是一家公司的内部资料,不方便进行分享,现在附上我在网上找的一个si4438的驱动,和我所用驱动有很多相似之处。由于我没对这个确定进行测试,无法保证它的可行性。这个驱动的好处是用户可见,而且有很多注释,我当时写程序,很大程度上参考了它。
    注:本驱动非我所写,是我在PUDN上下的,版权归原作者所有。由于时间已久,无法找到原作者信息,在此表示抱歉。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
buxinshan 发表于 2015-6-5 13:43 | 显示全部楼层
minton123 发表于 2015-5-12 09:48
哪你这个SI4438的电路有没有电子开关的,就是有接收和发送用SI4438的GPIO口来回切换的,如果有,就要配置 ...

我现在用芯片印着“44381C”  是B版还是C版,好晕啊
liuqianxin11 发表于 2015-6-26 17:15 | 显示全部楼层
您好!我想问下怎样判断4438发送数据是否成功呢?
threears 发表于 2015-7-8 16:47 | 显示全部楼层
求问楼主关于SI4438的CCA功能是如何设置的。
lclhitwh 发表于 2015-9-22 09:03 | 显示全部楼层
楼主好人,资料好详细,多谢了
hanson_chc 发表于 2015-9-22 20:46 | 显示全部楼层
木头0 发表于 2015-5-13 20:58
由于我用的是一家公司的内部资料,不方便进行分享,现在附上我在网上找的一个si4438的驱动,和我所用驱 ...

能把你的配置文件发一分吗
badmanfirst 发表于 2015-10-7 15:55 | 显示全部楼层
大哥能给个QQ联系方式吗有很多问题想请教你
diannaoza 发表于 2016-2-2 13:27 | 显示全部楼层
hanson_chc 发表于 2015-9-22 20:46
能把你的配置文件发一分吗

:)
798361971 发表于 2016-2-17 11:22 | 显示全部楼层
木头0 发表于 2015-5-13 20:58
由于我用的是一家公司的内部资料,不方便进行分享,现在附上我在网上找的一个si4438的驱动,和我所用驱 ...

你有没有关于SI4438无线收发芯片的一些资料啊,能不能发我点 我是刚接触无线通信这块什么都不懂 能不能发些基础的资料给我 谢啦:lol
黑外套 发表于 2016-7-22 12:38 | 显示全部楼层
非常感谢  这个可以参考一下 最近在做这个
落叶飘飘 发表于 2016-10-14 15:07 | 显示全部楼层
minton123 发表于 2015-5-11 14:13
我是这样读取RSSI的值,先用WDS软件设设置好在哪里读取RSSI的值。比如收到同步字之后,然后把这个RSSI的值放 ...

你好,我现在在调试SI4438,可以实现收发数据,按照你的办法,在WDS中设置RSSI所存在同步码之后,在收到同步码后, 通过快速寄存器A读取RSSI,获取的值一直是0。
下面是我的WDS配置及读取RSSI的程序,麻烦帮我判断是哪里出的问题,多谢!
接收数据程序:
u8 bRadio_Check_Tx_RX(void)
{
          u8 kk;
        u8 tmp;
        u8 rssi = 0;
          if(radio_hal_NirqLevel() == RESET)
        {
                    /* Read ITs, clear pending ones */
                    si446x_get_int_status(0u, 0u, 0u);

                kk = Si446xCmd.GET_INT_STATUS.CHIP_PEND;
               if(kk & SI446X_CMD_GET_CHIP_STATUS_REP_CMD_ERROR_PEND_BIT)
                      {       
                              /* State change to */
                              si446x_change_state(SI446X_CMD_CHANGE_STATE_ARG_NEW_STATE_ENUM_SLEEP);
       
                          /* Reset FIFO */
                              si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_RX_BIT);

                          /* State change to */
                              si446x_change_state(SI446X_CMD_CHANGE_STATE_ARG_NEW_STATE_ENUM_RX);
                     }

                    /* check the reason for the IT */
                    if(Si446xCmd.GET_INT_STATUS.MODEM_PEND & SI446X_CMD_GET_INT_STATUS_REP_SYNC_DETECT_PEND_BIT)
                    {//同步码检测
                            si446x_frr_a_read(rssi);//读取快速寄存器A中存储的RSSI
                        while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
                        USART_SendData(USART1,rssi);//串口打印输出       
                        GPIO_Reverse(RECEIVEUART_LED_PORT, RECEIVEUART_LED_PIN);
                    }

                    if(Si446xCmd.GET_INT_STATUS.PH_PEND & SI446X_CMD_GET_INT_STATUS_REP_PACKET_RX_PEND_BIT)
                    {

                              /* Read the length of RX_FIFO */
                              si446x_fifo_info(0u);

                              /* Packet RX */
                              //si446x_read_rx_fifo(Si446xCmd.FIFO_INFO.RX_FIFO_COUNT, &fixRadioPacket[0]);
                              si446x_read_rx_fifo(Si446xCmd.FIFO_INFO.RX_FIFO_COUNT, variableRadioPacket);
                        UART1ToPC(variableRadioPacket,Si446xCmd.FIFO_INFO.RX_FIFO_COUNT);
                              return TRUE;
                    }

                    if (Si446xCmd.GET_INT_STATUS.PH_PEND & SI446X_CMD_GET_INT_STATUS_REP_CRC_ERROR_BIT)
                    {
                              /* Reset FIFO */
                              si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_RX_BIT);
                    }
          }

          return 0;
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

8

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部