From 0e7661539e5b7aec0fbe0aaccd6938b7a37c384f Mon Sep 17 00:00:00 2001 From: peabody124 Date: Wed, 5 Jan 2011 10:34:42 +0000 Subject: [PATCH] OP-238 AHRS Comms: Bring down clock rate of comms to AHRS to 2.25 MHz. Decrease to only transmitting one object per transmission too to keep size down. Also move to using the driver structure so the paramter is in a clear place. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2333 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/Libraries/ahrs_spi_comm.c | 4 ++-- flight/OpenPilot/System/pios_board.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flight/Libraries/ahrs_spi_comm.c b/flight/Libraries/ahrs_spi_comm.c index 8b0a506a6..c839f3791 100644 --- a/flight/Libraries/ahrs_spi_comm.c +++ b/flight/Libraries/ahrs_spi_comm.c @@ -53,7 +53,7 @@ typedef enum { COMMS_NULL, COMMS_OBJECT } COMMSCOMMAND; //The maximum number of objects that can be updated in one cycle. //Currently the link is capable of sending 3 packets per cycle but 2 is enough -#define MAX_UPDATE_OBJECTS 2 +#define MAX_UPDATE_OBJECTS 1 //Number of transmissions + 1 before we expect to see the data acknowledge //This is controlled by the SPI hardware. @@ -144,7 +144,7 @@ void AhrsInitComms(void) #ifdef IN_AHRS PIOS_SPI_Init(); #else - PIOS_SPI_SetClockSpeed(PIOS_OPAHRS_SPI, PIOS_SPI_PRESCALER_8); //36MHz/16 = 2.25MHz + /* Comms already init in OP code */ for (int ct = 0; ct < MAX_AHRS_OBJECTS; ct++) { AhrsObjHandle hdl = AhrsFromIndex(ct); if (hdl) { diff --git a/flight/OpenPilot/System/pios_board.c b/flight/OpenPilot/System/pios_board.c index 4903e13dd..7b13c0400 100644 --- a/flight/OpenPilot/System/pios_board.c +++ b/flight/OpenPilot/System/pios_board.c @@ -101,7 +101,7 @@ const struct pios_spi_cfg pios_spi_sdcard_cfg = { .SPI_CRCPolynomial = 7, .SPI_CPOL = SPI_CPOL_High, .SPI_CPHA = SPI_CPHA_2Edge, - .SPI_BaudRatePrescaler = 7 << 3, /* Maximum divider (ie. slowest clock rate) */ + .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256, /* Maximum divider (ie. slowest clock rate) */ }, .dma = { .ahb_clk = RCC_AHBPeriph_DMA1, @@ -199,7 +199,7 @@ const struct pios_spi_cfg pios_spi_ahrs_cfg = { .SPI_CRCPolynomial = 7, .SPI_CPOL = SPI_CPOL_High, .SPI_CPHA = SPI_CPHA_2Edge, - .SPI_BaudRatePrescaler = 7 << 3, /* Maximum divider (ie. slowest clock rate) */ + .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16, }, .use_crc = TRUE, .dma = {