[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [5285] fixing crc computation on spi link
From: |
antoine drouin |
Subject: |
[paparazzi-commits] [5285] fixing crc computation on spi link |
Date: |
Mon, 09 Aug 2010 22:18:39 +0000 |
Revision: 5285
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5285
Author: poine
Date: 2010-08-09 22:18:37 +0000 (Mon, 09 Aug 2010)
Log Message:
-----------
fixing crc computation on spi link
Modified Paths:
--------------
paparazzi3/trunk/sw/airborne/fms/fms_autopilot_msg.h
paparazzi3/trunk/sw/airborne/fms/fms_spi_link.c
paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.c
paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.h
Modified: paparazzi3/trunk/sw/airborne/fms/fms_autopilot_msg.h
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/fms_autopilot_msg.h 2010-08-09
20:04:47 UTC (rev 5284)
+++ paparazzi3/trunk/sw/airborne/fms/fms_autopilot_msg.h 2010-08-09
22:18:37 UTC (rev 5285)
@@ -4,6 +4,7 @@
#include <inttypes.h>
#include "math/pprz_algebra_int.h"
#include "airframe.h"
+#include "fms/fms_crc.h"
#define LISA_PWM_OUTPUT_NB 6
@@ -61,7 +62,7 @@
*/
/* used to indicate parts of the message which actually represent a new
measurement */
-struct PTUpValidFlags
+struct __attribute__ ((packed)) PTUpValidFlags
{
unsigned rc:1;
unsigned pressure:1;
@@ -98,5 +99,10 @@
struct OVERO_LINK_MSG_DOWN msg_down;
};
+struct __attribute__ ((packed)) AutopilotMessageCRCFrame
+{
+ union AutopilotMessage payload;
+ crc_t crc;
+};
#endif /* FMS_AUTOPILOT_H */
Modified: paparazzi3/trunk/sw/airborne/fms/fms_spi_link.c
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/fms_spi_link.c 2010-08-09 20:04:47 UTC
(rev 5284)
+++ paparazzi3/trunk/sw/airborne/fms/fms_spi_link.c 2010-08-09 22:18:37 UTC
(rev 5285)
@@ -16,7 +16,7 @@
spi_link.mode = SPI_CPHA;
// spi_link.mode = SPI_LSB_FIRST;
spi_link.bits = 8;
- spi_link.speed = 500000;
+ spi_link.speed = 3000000;
spi_link.delay = 1;
spi_link.fd = open(spi_link.device, O_RDWR);
Modified:
paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.c
===================================================================
--- paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.c
2010-08-09 20:04:47 UTC (rev 5284)
+++ paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.c
2010-08-09 22:18:37 UTC (rev 5285)
@@ -104,6 +104,7 @@
/* Enable DMA1 Channel2 Transfer Complete interrupt */
DMA_ITConfig(DMA1_Channel2, DMA_IT_TC, ENABLE);
+ /* resets CRC module */
SPI_Cmd(SPI1, DISABLE);
SPI_CalculateCRC(SPI1, DISABLE);
SPI_CalculateCRC(SPI1, ENABLE);
@@ -112,18 +113,15 @@
}
void dma1_c2_irq_handler(void) {
- DEBUG_S2_ON();
+
+ // DEBUG_S2_ON();
DMA_ITConfig(DMA1_Channel2, DMA_IT_TC, DISABLE);
overo_link.status = DATA_AVAILABLE;
- // overo_link.status = DATA_AVAILABLE;
- // else
- // overo_link.status = CRC_ERROR;
+ // DEBUG_S2_OFF();
- DEBUG_S2_OFF();
-
}
Modified:
paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.h
===================================================================
--- paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.h
2010-08-09 20:04:47 UTC (rev 5284)
+++ paparazzi3/trunk/sw/airborne/lisa/arch/stm32/lisa_overo_link_crc_arch.h
2010-08-09 22:18:37 UTC (rev 5285)
@@ -6,22 +6,23 @@
#define OveroLinkEvent(_data_received_handler, _crc_failed_handler) { \
if (overo_link.status == DATA_AVAILABLE) { \
- DEBUG_S1_ON(); \
overo_link.timeout = 0; \
while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE)==RESET); \
- uint8_t blaaa = SPI_I2S_ReceiveData(SPI1); \
- /* if((SPI_I2S_GetFlagStatus(SPI1, SPI_FLAG_CRCERR)) == RESET) */\
- _data_received_handler();
\
+ while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY)==SET); \
+ uint8_t foo __attribute__ ((unused)) = SPI_I2S_ReceiveData(SPI1); \
+ if((SPI_I2S_GetFlagStatus(SPI1, SPI_FLAG_CRCERR)) == RESET) { \
+ LED_TOGGLE(OVERO_LINK_LED_OK); \
+ LED_OFF(OVERO_LINK_LED_KO); \
+ _data_received_handler(); \
+ }
\
+ else { \
+ LED_OFF(OVERO_LINK_LED_OK); \
+ LED_ON(OVERO_LINK_LED_KO); \
+ _crc_failed_handler(); \
+ }
\
overo_link_arch_prepare_next_transfert(0); \
overo_link.status = IDLE;
\
- DEBUG_S1_OFF(); \
} \
- else if(overo_link.status == CRC_ERROR) { \
- _crc_failed_handler(); \
- overo_link_arch_prepare_next_transfert(0); \
- overo_link.status = IDLE;
\
- } \
}
-
#endif /* LISA_OVERO_LINK_ARCH_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [5285] fixing crc computation on spi link,
antoine drouin <=