paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] stm32 how to make UART5 rx pin a led pin


From: Felix Ruess
Subject: Re: [Paparazzi-devel] stm32 how to make UART5 rx pin a led pin
Date: Sun, 7 Oct 2012 13:52:54 +0200

Hi Chris,

that is actually an intentional feature of the call procedure in the flight plan:
http://paparazzi.enac.fr/wiki/Flight_Plans#Call

Remember that each element in a block is a separate stage, and since LED_ON(x) evaluates to true, the next stage (in this case the call to the second LED_ON) is never reached.
Neither are the other stages of that block for that matter... which is clearly not what you want.

So either you write a wrapper function that returns false or directly hack it into the call:
    <block name="Wait GPS">
      <set value="1" var="kill_throttle"/>
      <call fun="{LED_ON(12); FALSE;}"/>
      <call fun="{LED_ON(13); FALSE;}"/>
      <while cond="!GpsFixValid()"/>
    </block>
Of course you could also combine both LED_ON into one call: <call fun="{LED_ON(12); LED_ON(13); FALSE;}"/>

Or pre_call attribute of the block instead to call these _every_ time the block is executed:
    <block name="Wait GPS" pre_call="LED_ON(12);LED_ON(13)">
      <set value="1" var="kill_throttle"/>
      <while cond="!GpsFixValid()"/>
    </block>

Cheers, Felix

On Sun, Oct 7, 2012 at 12:51 PM, Chris <address@hidden> wrote:
Hi.
I just finished reading the STM32 manual and the paparazzi code and now i feel that i know how the internals of LISA work.
I do have a problem though with leds.
I edited the lisa_m_2.0.h file and added LED 13 which is connected to UART5 Rx pin
#define LED_13_GPIO GPIOD
#define LED_13_GPIO_CLK RCC_APB2Periph_GPIOD
#define LED_13_GPIO_PIN GPIO_Pin_2
#define LED_13_AFIO_REMAP ((void)0)

and the led.h
#if USE_LED_13
  LED_INIT(13); // The led pin is initialized in "led_hw.h"
  LED_OFF(13);
#endif /* LED_13 */

Now when i test them from the flight plan like this:
    <block name="Wait GPS">
      <call fun="LED_ON(12)"/>
      <call fun="LED_ON(13)"/>
      <set value="1" var="kill_throttle"/>
      .
      .
      etc.

only the first LED_ON(x) is working in this case the LED 12 which goes low.
The other one remains on a high state.
If i reverse the order that they appear in the flight plan then LED 13 is working
and LED 12 is left high when it should be in a low state.
It almost looks like an STM32 bug or i am missing something here.
UART 5 is not used of course.
Chris


_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]