1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2903 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2011-02-27 13:13:10 +00:00 committed by pip
parent 2eaedfe78a
commit 7bfb58ce73
2 changed files with 25 additions and 10 deletions

View File

@ -323,10 +323,10 @@ void init_RF_module(void)
default:
#if defined(PIOS_COM_DEBUG)
DEBUG_PRINTF("UNKNOWN BAND ERROR\r\n", i);
DEBUG_PRINTF("UNKNOWN BAND ERROR\r\n\r\n", i);
#endif
for (int j = 0; j < 8; j++)
for (int j = 0; j < 16; j++)
{
USB_LED_ON;
LINK_LED_OFF;
@ -359,10 +359,10 @@ void init_RF_module(void)
{ // RF module error .. flash the LED's
#if defined(PIOS_COM_DEBUG)
DEBUG_PRINTF("RF ERROR res: %d\r\n", i);
DEBUG_PRINTF("RF ERROR res: %d\r\n\r\n", i);
#endif
for (int j = 0; j < 6; j++)
for (int j = 0; j < 16; j++)
{
USB_LED_ON;
LINK_LED_ON;

View File

@ -1854,6 +1854,11 @@ int rfm22_resetModule(uint8_t mode)
// set SPI port SCLK frequency .. 4.5MHz
PIOS_SPI_SetClockSpeed(RFM22_PIOS_SPI, PIOS_SPI_PRESCALER_16);
// set SPI port SCLK frequency .. 2.25MHz
// PIOS_SPI_SetClockSpeed(RFM22_PIOS_SPI, PIOS_SPI_PRESCALER_32);
// set SPI port SCLK frequency .. 285kHz .. purely for hardware fault finding
// PIOS_SPI_SetClockSpeed(RFM22_PIOS_SPI, PIOS_SPI_PRESCALER_256);
// ****************
// software reset the RF chip .. following procedure according to Si4x3x Errata (rev. B)
@ -1941,22 +1946,32 @@ int rfm22_resetModule(uint8_t mode)
// read the RF chip ID bytes
device_type = rfm22_read(RFM22_DEVICE_TYPE) & RFM22_DT_MASK; // read the device type
device_version = rfm22_read(RFM22_DEVICE_VERSION) & RFM22_DV_MASK; // read the device version
#if defined(RFM22_DEBUG)
DEBUG_PRINTF("rf device type: %d\r\n", device_type);
#endif
if (device_type != 0x08)
return -1; // incorrect RF module type
device_version = rfm22_read(RFM22_DEVICE_VERSION) & RFM22_DV_MASK; // read the device version
#if defined(RFM22_DEBUG)
DEBUG_PRINTF("rf device version: %d\r\n", device_version);
#endif
if (device_type != 0x08)
{
#if defined(RFM22_DEBUG)
DEBUG_PRINTF("rf device type: INCORRECT - should be 0x08\r\n");
#endif
return -1; // incorrect RF module type
}
// if (device_version != RFM22_DEVICE_VERSION_V2) // V2
// return -2; // incorrect RF module version
// if (device_version != RFM22_DEVICE_VERSION_A0) // A0
// return -2; // incorrect RF module version
if (device_version != RFM22_DEVICE_VERSION_B1) // B1
{
#if defined(RFM22_DEBUG)
DEBUG_PRINTF("rf device version: INCORRECT\r\n");
#endif
return -2; // incorrect RF module version
}
// ****************