[Mod] 调相频率868
This commit is contained in:
@ -149,6 +149,274 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#if ( PRODUCT_FREQUENCY == CM2310A_868MHZ)
|
#if ( PRODUCT_FREQUENCY == CM2310A_868MHZ)
|
||||||
|
|
||||||
|
const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
||||||
|
0x2A,
|
||||||
|
0x42,
|
||||||
|
0x00,
|
||||||
|
0xAA,
|
||||||
|
0x04,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x64,
|
||||||
|
0xD1,
|
||||||
|
0xCE,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x64,
|
||||||
|
0xD1,
|
||||||
|
0xCE,
|
||||||
|
0x1F,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x2D,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x2D,
|
||||||
|
0x41,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x05,
|
||||||
|
0x80,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x08,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x1F,
|
||||||
|
0x07,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xE4,
|
||||||
|
0x20,
|
||||||
|
0x1A,
|
||||||
|
0x60,
|
||||||
|
0x08,
|
||||||
|
0x00,
|
||||||
|
0xAA,
|
||||||
|
0x00,
|
||||||
|
0xE2,
|
||||||
|
0x82,
|
||||||
|
0x38,
|
||||||
|
0x00,
|
||||||
|
0xD0,
|
||||||
|
0xE0,
|
||||||
|
0x80,
|
||||||
|
0x00,
|
||||||
|
0x41,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x02,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x03,
|
||||||
|
0x04,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
||||||
|
0x10,
|
||||||
|
0x06,
|
||||||
|
0x00,
|
||||||
|
0xFF,
|
||||||
|
0x00,
|
||||||
|
0xCD, // vRadioTcxoDrvSel 接收设置的,将0xcd变为了0x0d
|
||||||
|
0x0E,
|
||||||
|
0x20,
|
||||||
|
0x50,
|
||||||
|
0x87,
|
||||||
|
0x31,
|
||||||
|
0x5B,
|
||||||
|
0x08,
|
||||||
|
0x38,
|
||||||
|
0xFF,
|
||||||
|
0x00,
|
||||||
|
0x6C,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x08,
|
||||||
|
0xB4,
|
||||||
|
0x04,
|
||||||
|
0x56,
|
||||||
|
0xE0,
|
||||||
|
0x20,
|
||||||
|
0x08,
|
||||||
|
0x01,
|
||||||
|
0x10,
|
||||||
|
0x11,
|
||||||
|
0x00,
|
||||||
|
0x91,
|
||||||
|
0x7F,
|
||||||
|
0x00,
|
||||||
|
0x18,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x1F,
|
||||||
|
0xE4,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xC0,
|
||||||
|
0x6C,
|
||||||
|
0x00,
|
||||||
|
0x80,
|
||||||
|
0x98,
|
||||||
|
0x6B,
|
||||||
|
0x00,
|
||||||
|
0x80,
|
||||||
|
0x0F,
|
||||||
|
0x64,
|
||||||
|
0x06,
|
||||||
|
0x02,
|
||||||
|
0x04,
|
||||||
|
0x56,
|
||||||
|
0x00,
|
||||||
|
0x36,
|
||||||
|
0x05,
|
||||||
|
0x20,
|
||||||
|
0xC8,
|
||||||
|
0x63,
|
||||||
|
0xA1,
|
||||||
|
0xFA,
|
||||||
|
0x02,
|
||||||
|
0x58,
|
||||||
|
0x40,
|
||||||
|
0x54,
|
||||||
|
0x74,
|
||||||
|
0xD0,
|
||||||
|
0x0F,
|
||||||
|
0x01,
|
||||||
|
0x1B,
|
||||||
|
0xE6,
|
||||||
|
0x54,
|
||||||
|
0x0C,
|
||||||
|
0x09,
|
||||||
|
0xE2,
|
||||||
|
0x33,
|
||||||
|
0x04,
|
||||||
|
0x01,
|
||||||
|
0xA5,
|
||||||
|
0x06,
|
||||||
|
0x0F,
|
||||||
|
0x12,
|
||||||
|
0x4C,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xF6,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x18,
|
||||||
|
0x81,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x47,
|
||||||
|
0x12, //0x67寄存器,ANT_DIVERSITY_MODE设置电线分集的接口会修改它
|
||||||
|
0x25,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* [CMT page2] */
|
||||||
|
const uint8_t g_cmt2310a_page2[CMT2310A_PAGE2_SIZE] = {
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x02,
|
||||||
|
0x03,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* [CMT page0] */
|
/* [CMT page0] */
|
||||||
const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
||||||
0x12,
|
0x12,
|
||||||
@ -231,7 +499,7 @@ const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
|||||||
0x00,
|
0x00,
|
||||||
0x03,
|
0x03,
|
||||||
0x04,
|
0x04,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* [CMT page1] */
|
/* [CMT page1] */
|
||||||
const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
||||||
@ -347,6 +615,7 @@ const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
|||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|||||||
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
|
#define GET_CHIP_INFO_RETRY_MAX 10
|
||||||
|
|
||||||
uint8_t rf_rxbuffer[200];
|
uint8_t rf_rxbuffer[200];
|
||||||
uint8_t rf_rxsize;
|
uint8_t rf_rxsize;
|
||||||
uint8_t radio_rece_data_flag;
|
uint8_t radio_rece_data_flag;
|
||||||
@ -29,28 +31,50 @@ extern uint32_t g_chip_id;
|
|||||||
|
|
||||||
void Ebyte_E48x_Init( void )
|
void Ebyte_E48x_Init( void )
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
uint8_t chip_state = 0;
|
||||||
|
uint32_t fail_retry = 0;
|
||||||
|
boolean_t is_chip_cmt2310 = FALSE;
|
||||||
|
|
||||||
|
vSpiMasterInit();
|
||||||
|
|
||||||
|
init_prepare:
|
||||||
/* Step1 */
|
/* Step1 */
|
||||||
vRadioPowerUp(); // Release RST(GPIO5)
|
g_chip_id = lRadioChipVersion();
|
||||||
vRadioSetAntSwitch(FALSE, FALSE); // Disable GPIO0 & GPIO1 as antenna switch control
|
chip_state = bRadioGetState();
|
||||||
vRadioSpiModeSel(FALSE); // SPI 4-Wire mode
|
// OSAL_LOGD("Debug, got information Version[%#X] State[%#X].", g_chip_id, chip_state);
|
||||||
|
|
||||||
|
is_chip_cmt2310 = ((g_chip_id & 0x00FFFF00) == 0x00231000);
|
||||||
|
if (is_chip_cmt2310 && (chip_state == CMT2310A_STATE_IS_READY)) {
|
||||||
|
printf("Infor, CMT2310 already in State[READY], so skip initialization.");
|
||||||
|
goto init_end;
|
||||||
|
}
|
||||||
|
else if (is_chip_cmt2310 && (!chip_state || chip_state & 0x80)) { // Valid mode, except IDLE and READY
|
||||||
|
printf("Debug, initialize CMT2310 right now with current State[%#X].", chip_state);
|
||||||
|
goto init_run;
|
||||||
|
}
|
||||||
|
else if (fail_retry++ >= GET_CHIP_INFO_RETRY_MAX) {
|
||||||
|
printf("Error, get the information of CMT2310 failed with Chip-ID[%#X] State[%#X].", g_chip_id, chip_state);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if (fail_retry == 1) {
|
||||||
|
vRadioPowerUp(); // Release RST(GPIO5)
|
||||||
|
delay1ms(20);
|
||||||
|
}
|
||||||
|
|
||||||
/* Step2 */
|
/* Step2 */
|
||||||
g_chip_id = lRadioChipVersion();
|
vRadioSoftReset(); // Software reset
|
||||||
if(0x00231000 != (g_chip_id & 0x00FFFF00)) {
|
vRadioBoot(); // Boot CMT2310 core
|
||||||
EBYTE_LOG("[%s|%u] Error, dismatch Chip-ID[%#x](!=0x231000).\r\n", __FUNCTION__, __LINE__, g_chip_id);
|
delay1ms(50);
|
||||||
return;
|
|
||||||
}
|
|
||||||
EBYTE_LOG("[%s|%u] Info, Link Device:E48-XXXM20S.\r\n", __FUNCTION__, __LINE__);
|
|
||||||
|
|
||||||
/* Step3 */
|
goto init_prepare;
|
||||||
if (bRadioGetState() == CMT2310A_STATE_IS_READY) {
|
init_run:
|
||||||
EBYTE_LOG("[%s|%u] Infor, CMT2310 already in State[READY], so skip initialization.\r\n", __FUNCTION__, __LINE__);
|
/* Step3~6 */
|
||||||
return;
|
|
||||||
}
|
|
||||||
EBYTE_LOG("[%s|%u] Info, goto initialize E48-XXXM20S.\r\n", __FUNCTION__, __LINE__);
|
|
||||||
|
|
||||||
/* Step4 */
|
|
||||||
vRadioInit();
|
vRadioInit();
|
||||||
|
|
||||||
|
init_end:
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ebyte_E48x_SendPayload( uint8_t *payload, uint8_t size, uint32_t timeout )
|
void Ebyte_E48x_SendPayload( uint8_t *payload, uint8_t size, uint32_t timeout )
|
||||||
|
|||||||
@ -430,6 +430,11 @@ void vRadioRegPageSel( uint8_t page_sel )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vRadioBoot( void )
|
||||||
|
{
|
||||||
|
bSpiWriteByte( CMT2310A_CTL_REG_00, CMT2310A_REBOOT );
|
||||||
|
}
|
||||||
|
|
||||||
/******************************
|
/******************************
|
||||||
**Name: vRadioPowerUpBoot
|
**Name: vRadioPowerUpBoot
|
||||||
**Func: Radio power up boot start
|
**Func: Radio power up boot start
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
#define CM2310A_868MHZ 2
|
#define CM2310A_868MHZ 2
|
||||||
#define CM2310A_915MHZ 3
|
#define CM2310A_915MHZ 3
|
||||||
|
|
||||||
#define PRODUCT_FREQUENCY CM2310A_410MHZ//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
#define PRODUCT_FREQUENCY CM2310A_868MHZ//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
||||||
|
|
||||||
#include "radio_spi.h"
|
#include "radio_spi.h"
|
||||||
#include "CMT2310A_def.h"
|
#include "CMT2310A_def.h"
|
||||||
@ -83,7 +83,6 @@ extern void vRadioXoWaitCfg( uint8_t div_sel );
|
|||||||
|
|
||||||
extern void delay1ms(uint16_t cnt);
|
extern void delay1ms(uint16_t cnt);
|
||||||
extern void delay10us(uint32_t cnt);
|
extern void delay10us(uint32_t cnt);
|
||||||
|
|
||||||
|
void vRadioBoot( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -149,6 +149,274 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#if ( PRODUCT_FREQUENCY == CM2310A_868MHZ)
|
#if ( PRODUCT_FREQUENCY == CM2310A_868MHZ)
|
||||||
|
|
||||||
|
const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
||||||
|
0x2A,
|
||||||
|
0x42,
|
||||||
|
0x00,
|
||||||
|
0xAA,
|
||||||
|
0x04,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x64,
|
||||||
|
0xD1,
|
||||||
|
0xCE,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x64,
|
||||||
|
0xD1,
|
||||||
|
0xCE,
|
||||||
|
0x1F,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x2D,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x2D,
|
||||||
|
0x41,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x05,
|
||||||
|
0x80,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x08,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x1F,
|
||||||
|
0x07,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xE4,
|
||||||
|
0x20,
|
||||||
|
0x1A,
|
||||||
|
0x60,
|
||||||
|
0x08,
|
||||||
|
0x00,
|
||||||
|
0xAA,
|
||||||
|
0x00,
|
||||||
|
0xE2,
|
||||||
|
0x82,
|
||||||
|
0x38,
|
||||||
|
0x00,
|
||||||
|
0xD0,
|
||||||
|
0xE0,
|
||||||
|
0x80,
|
||||||
|
0x00,
|
||||||
|
0x41,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x02,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x03,
|
||||||
|
0x04,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
||||||
|
0x10,
|
||||||
|
0x06,
|
||||||
|
0x00,
|
||||||
|
0xFF,
|
||||||
|
0x00,
|
||||||
|
0xCD, // vRadioTcxoDrvSel 接收设置的,将0xcd变为了0x0d
|
||||||
|
0x0E,
|
||||||
|
0x20,
|
||||||
|
0x50,
|
||||||
|
0x87,
|
||||||
|
0x31,
|
||||||
|
0x5B,
|
||||||
|
0x08,
|
||||||
|
0x38,
|
||||||
|
0xFF,
|
||||||
|
0x00,
|
||||||
|
0x6C,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x08,
|
||||||
|
0xB4,
|
||||||
|
0x04,
|
||||||
|
0x56,
|
||||||
|
0xE0,
|
||||||
|
0x20,
|
||||||
|
0x08,
|
||||||
|
0x01,
|
||||||
|
0x10,
|
||||||
|
0x11,
|
||||||
|
0x00,
|
||||||
|
0x91,
|
||||||
|
0x7F,
|
||||||
|
0x00,
|
||||||
|
0x18,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x1F,
|
||||||
|
0xE4,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xC0,
|
||||||
|
0x6C,
|
||||||
|
0x00,
|
||||||
|
0x80,
|
||||||
|
0x98,
|
||||||
|
0x6B,
|
||||||
|
0x00,
|
||||||
|
0x80,
|
||||||
|
0x0F,
|
||||||
|
0x64,
|
||||||
|
0x06,
|
||||||
|
0x02,
|
||||||
|
0x04,
|
||||||
|
0x56,
|
||||||
|
0x00,
|
||||||
|
0x36,
|
||||||
|
0x05,
|
||||||
|
0x20,
|
||||||
|
0xC8,
|
||||||
|
0x63,
|
||||||
|
0xA1,
|
||||||
|
0xFA,
|
||||||
|
0x02,
|
||||||
|
0x58,
|
||||||
|
0x40,
|
||||||
|
0x54,
|
||||||
|
0x74,
|
||||||
|
0xD0,
|
||||||
|
0x0F,
|
||||||
|
0x01,
|
||||||
|
0x1B,
|
||||||
|
0xE6,
|
||||||
|
0x54,
|
||||||
|
0x0C,
|
||||||
|
0x09,
|
||||||
|
0xE2,
|
||||||
|
0x33,
|
||||||
|
0x04,
|
||||||
|
0x01,
|
||||||
|
0xA5,
|
||||||
|
0x06,
|
||||||
|
0x0F,
|
||||||
|
0x12,
|
||||||
|
0x4C,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0xF6,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x18,
|
||||||
|
0x81,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x47,
|
||||||
|
0x12, //0x67寄存器,ANT_DIVERSITY_MODE设置电线分集的接口会修改它
|
||||||
|
0x25,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* [CMT page2] */
|
||||||
|
const uint8_t g_cmt2310a_page2[CMT2310A_PAGE2_SIZE] = {
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x02,
|
||||||
|
0x03,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* [CMT page0] */
|
/* [CMT page0] */
|
||||||
const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
||||||
0x12,
|
0x12,
|
||||||
@ -231,7 +499,7 @@ const uint8_t g_cmt2310a_page0[CMT2310A_PAGE0_SIZE] = {
|
|||||||
0x00,
|
0x00,
|
||||||
0x03,
|
0x03,
|
||||||
0x04,
|
0x04,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* [CMT page1] */
|
/* [CMT page1] */
|
||||||
const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
||||||
@ -347,6 +615,7 @@ const uint8_t g_cmt2310a_page1[CMT2310A_PAGE1_SIZE] = {
|
|||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|||||||
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
|
#define GET_CHIP_INFO_RETRY_MAX 10
|
||||||
|
|
||||||
uint8_t rf_rxbuffer[200];
|
uint8_t rf_rxbuffer[200];
|
||||||
uint8_t rf_rxsize;
|
uint8_t rf_rxsize;
|
||||||
uint8_t radio_rece_data_flag;
|
uint8_t radio_rece_data_flag;
|
||||||
@ -29,28 +31,50 @@ extern uint32_t g_chip_id;
|
|||||||
|
|
||||||
void Ebyte_E48x_Init( void )
|
void Ebyte_E48x_Init( void )
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
uint8_t chip_state = 0;
|
||||||
|
uint32_t fail_retry = 0;
|
||||||
|
boolean_t is_chip_cmt2310 = FALSE;
|
||||||
|
|
||||||
|
vSpiMasterInit();
|
||||||
|
|
||||||
|
init_prepare:
|
||||||
/* Step1 */
|
/* Step1 */
|
||||||
vRadioPowerUp(); // Release RST(GPIO5)
|
g_chip_id = lRadioChipVersion();
|
||||||
vRadioSetAntSwitch(FALSE, FALSE); // Disable GPIO0 & GPIO1 as antenna switch control
|
chip_state = bRadioGetState();
|
||||||
vRadioSpiModeSel(FALSE); // SPI 4-Wire mode
|
// OSAL_LOGD("Debug, got information Version[%#X] State[%#X].", g_chip_id, chip_state);
|
||||||
|
|
||||||
|
is_chip_cmt2310 = ((g_chip_id & 0x00FFFF00) == 0x00231000);
|
||||||
|
if (is_chip_cmt2310 && (chip_state == CMT2310A_STATE_IS_READY)) {
|
||||||
|
DEBUGPRINT("Infor, CMT2310 already in State[READY], so skip initialization.");
|
||||||
|
goto init_end;
|
||||||
|
}
|
||||||
|
else if (is_chip_cmt2310 && (!chip_state || chip_state & 0x80)) { // Valid mode, except IDLE and READY
|
||||||
|
DEBUGPRINT("Debug, initialize CMT2310 right now with current State[%#X].", chip_state);
|
||||||
|
goto init_run;
|
||||||
|
}
|
||||||
|
else if (fail_retry++ >= GET_CHIP_INFO_RETRY_MAX) {
|
||||||
|
DEBUGPRINT("Error, get the information of CMT2310 failed with Chip-ID[%#X] State[%#X].", g_chip_id, chip_state);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if (fail_retry == 1) {
|
||||||
|
vRadioPowerUp(); // Release RST(GPIO5)
|
||||||
|
delay1ms(20);
|
||||||
|
}
|
||||||
|
|
||||||
/* Step2 */
|
/* Step2 */
|
||||||
g_chip_id = lRadioChipVersion();
|
vRadioSoftReset(); // Software reset
|
||||||
if(0x00231000 != (g_chip_id & 0x00FFFF00)) {
|
vRadioBoot(); // Boot CMT2310 core
|
||||||
DEBUGPRINT("[%s|%u] Error, dismatch Chip-ID[%#x](!=0x231000).\r\n", __FUNCTION__, __LINE__, g_chip_id);
|
delay1ms(50);
|
||||||
return;
|
|
||||||
}
|
|
||||||
DEBUGPRINT("[%s|%u] Info, Link Device:E48-XXXM20S.\r\n", __FUNCTION__, __LINE__);
|
|
||||||
|
|
||||||
/* Step3 */
|
goto init_prepare;
|
||||||
if (bRadioGetState() == CMT2310A_STATE_IS_READY) {
|
init_run:
|
||||||
DEBUGPRINT("[%s|%u] Infor, CMT2310 already in State[READY], so skip initialization.\r\n", __FUNCTION__, __LINE__);
|
/* Step3~6 */
|
||||||
return;
|
|
||||||
}
|
|
||||||
DEBUGPRINT("[%s|%u] Info, goto initialize E48-XXXM20S.\r\n", __FUNCTION__, __LINE__);
|
|
||||||
|
|
||||||
/* Step4 */
|
|
||||||
vRadioInit();
|
vRadioInit();
|
||||||
|
|
||||||
|
init_end:
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ebyte_E48x_SendPayload( uint8_t *payload, uint8_t size, uint32_t timeout )
|
void Ebyte_E48x_SendPayload( uint8_t *payload, uint8_t size, uint32_t timeout )
|
||||||
|
|||||||
@ -430,6 +430,11 @@ void vRadioRegPageSel( uint8_t page_sel )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vRadioBoot( void )
|
||||||
|
{
|
||||||
|
bSpiWriteByte( CMT2310A_CTL_REG_00, CMT2310A_REBOOT );
|
||||||
|
}
|
||||||
|
|
||||||
/******************************
|
/******************************
|
||||||
**Name: vRadioPowerUpBoot
|
**Name: vRadioPowerUpBoot
|
||||||
**Func: Radio power up boot start
|
**Func: Radio power up boot start
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
#define CM2310A_868MHZ 2
|
#define CM2310A_868MHZ 2
|
||||||
#define CM2310A_915MHZ 3
|
#define CM2310A_915MHZ 3
|
||||||
|
|
||||||
#define PRODUCT_FREQUENCY CM2310A_410MHZ//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
#define PRODUCT_FREQUENCY CM2310A_868MHZ//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
||||||
|
|
||||||
#include "radio_spi.h"
|
#include "radio_spi.h"
|
||||||
#include "CMT2310A_def.h"
|
#include "CMT2310A_def.h"
|
||||||
@ -83,6 +83,8 @@ extern void vRadioXoWaitCfg( uint8_t div_sel );
|
|||||||
|
|
||||||
extern void delay1ms(uint16_t cnt);
|
extern void delay1ms(uint16_t cnt);
|
||||||
extern void delay10us(uint32_t cnt);
|
extern void delay10us(uint32_t cnt);
|
||||||
|
|
||||||
|
extern void vRadioBoot( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user