1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

PipBee: Updating project files to fix compile errors. Routine just toggles each LED successively. There is a known error when enabling the PIOS_COM_Init(); or more specifically PIOS_USART_Init(); which blocks at some point when called. This may be due to the pios_board.c defines which I will check later today.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1361 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
patrick 2010-08-21 20:01:37 +00:00 committed by patrick
parent dea2529e38
commit 564a68e825
4 changed files with 247 additions and 221 deletions

View File

@ -85,18 +85,18 @@ TIM8 | | | |
#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN, PIOS_LED_LED3_GPIO_PIN, PIOS_LED_LED4_GPIO_PIN }
#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK, PIOS_LED_LED3_GPIO_CLK, PIOS_LED_LED4_GPIO_CLK }
#define USB_LED_ON PIOS_LED_On(LED1);
#define USB_LED_OFF PIOS_LED_Off(LED1);
#define USB_LED_TOGGLE PIOS_LED_Toggle(LED1);
#define LINK_LED_ON PIOS_LED_On(LED2);
#define LINK_LED_OFF PIOS_LED_Off(LED2);
#define LINK_LED_TOGGLE PIOS_LED_Toggle(LED2);
#define RX_LED_ON PIOS_LED_On(LED3);
#define RX_LED_OFF PIOS_LED_Off(LED3);
#define RX_LED_TOGGLE PIOS_LED_Toggle(LED3);
#define TX_LED_ON PIOS_LED_On(LED4);
#define TX_LED_OFF PIOS_LED_Off(LED4);
#define TX_LED_TOGGLE PIOS_LED_Toggle(LED4);
#define USB_LED_ON PIOS_LED_On(LED1)
#define USB_LED_OFF PIOS_LED_Off(LED1)
#define USB_LED_TOGGLE PIOS_LED_Toggle(LED1)
#define LINK_LED_ON PIOS_LED_On(LED2)
#define LINK_LED_OFF PIOS_LED_Off(LED2)
#define LINK_LED_TOGGLE PIOS_LED_Toggle(LED2)
#define RX_LED_ON PIOS_LED_On(LED3)
#define RX_LED_OFF PIOS_LED_Off(LED3)
#define RX_LED_TOGGLE PIOS_LED_Toggle(LED3)
#define TX_LED_ON PIOS_LED_On(LED4)
#define TX_LED_OFF PIOS_LED_Off(LED4)
#define TX_LED_TOGGLE PIOS_LED_Toggle(LED4)
//-------------------------
// Delay Timer

View File

@ -37,9 +37,11 @@
void PIOS_SPI_perif_irq_handler(void);
void DMA1_Channel5_IRQHandler() __attribute__ ((alias ("PIOS_SPI_perif_irq_handler")));
void DMA1_Channel4_IRQHandler() __attribute__ ((alias ("PIOS_SPI_perif_irq_handler")));
static const struct pios_spi_cfg pios_spi_perif_cfg = {
static const struct pios_spi_cfg pios_spi_perif_cfg =
{
.regs = SPI1,
.init = {
.init =
{
.SPI_Mode = SPI_Mode_Master,
.SPI_Direction = SPI_Direction_2Lines_FullDuplex,
.SPI_DataSize = SPI_DataSize_8b,
@ -50,23 +52,26 @@ static const struct pios_spi_cfg pios_spi_perif_cfg = {
.SPI_CPHA = SPI_CPHA_2Edge,
.SPI_BaudRatePrescaler = 7 << 3, /* Maximum divider (ie. slowest clock rate) */
},
.dma = {
.dma =
{
.ahb_clk = RCC_AHBPeriph_DMA1,
.irq = {
.irq =
{
.handler = PIOS_SPI_perif_irq_handler,
.flags = (DMA1_FLAG_TC4 | DMA1_FLAG_TE4 | DMA1_FLAG_HT4 | DMA1_FLAG_GL4),
.init = {
.init =
{
.NVIC_IRQChannel = DMA1_Channel4_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.rx =
{
.channel = DMA1_Channel4,
.init = {
.init =
{
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
.DMA_DIR = DMA_DIR_PeripheralSRC,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
@ -78,9 +83,11 @@ static const struct pios_spi_cfg pios_spi_perif_cfg = {
.DMA_M2M = DMA_M2M_Disable,
},
},
.tx = {
.tx =
{
.channel = DMA1_Channel5,
.init = {
.init =
{
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
.DMA_DIR = DMA_DIR_PeripheralDST,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
@ -93,33 +100,41 @@ static const struct pios_spi_cfg pios_spi_perif_cfg = {
},
},
},
.ssel = {
.ssel =
{
.gpio = GPIOA,
.init = {
.init =
{
.GPIO_Pin = GPIO_Pin_4,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
.sclk = {
.sclk =
{
.gpio = GPIOA,
.init = {
.init =
{
.GPIO_Pin = GPIO_Pin_5,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
.miso = {
.miso =
{
.gpio = GPIOA,
.init = {
.init =
{
.GPIO_Pin = GPIO_Pin_6,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
.mosi = {
.mosi =
{
.gpio = GPIOA,
.init = {
.init =
{
.GPIO_Pin = GPIO_Pin_7,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
@ -130,7 +145,8 @@ static const struct pios_spi_cfg pios_spi_perif_cfg = {
/*
* Board specific number of devices.
*/
struct pios_spi_dev pios_spi_devs[] = {
struct pios_spi_dev pios_spi_devs[] =
{
{
.cfg = &pios_spi_perif_cfg,
},
@ -154,9 +170,11 @@ void PIOS_SPI_perif_irq_handler(void)
*/
void PIOS_USART_com_irq_handler(void);
void USART3_IRQHandler() __attribute__ ((alias ("PIOS_USART_com_irq_handler")));
const struct pios_usart_cfg pios_usart_com_cfg = {
const struct pios_usart_cfg pios_usart_com_cfg =
{
.regs = USART1,
.init = {
.init =
{
.USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
@ -164,26 +182,32 @@ const struct pios_usart_cfg pios_usart_com_cfg = {
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.irq =
{
.handler = PIOS_USART_com_irq_handler,
.init = {
.init =
{
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.rx =
{
.gpio = GPIOA,
.init = {
.init =
{
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.tx =
{
.gpio = GPIOA,
.init = {
.init =
{
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
@ -194,7 +218,8 @@ const struct pios_usart_cfg pios_usart_com_cfg = {
/*
* Board specific number of devices.
*/
struct pios_usart_dev pios_usart_devs[] = {
struct pios_usart_dev pios_usart_devs[] =
{
#define PIOS_USART_COM 0
{
.cfg = &pios_usart_com_cfg,
@ -222,7 +247,8 @@ void PIOS_USART_com_irq_handler(void)
*/
extern const struct pios_com_driver pios_usart_com_driver;
struct pios_com_dev pios_com_devs[] = {
struct pios_com_dev pios_com_devs[] =
{
{
.id = PIOS_USART_COM,
.driver = &pios_usart_com_driver,

View File

@ -58,7 +58,7 @@ int main()
PIOS_DELAY_Init();
// UART communication system
PIOS_COM_Init();
//PIOS_COM_Init(); // TODO: Find problem when enabling this
// ADC system
PIOS_ADC_Init();