Page 1 of 1

Serial Driver Input for Events Error

Posted: Tue Mar 19, 2013 1:36 am
by erwinkendo
Hello Giovany and other forum members

Today I come here because I used event for SERIAL Driver input a long time and now with the new functions I was testing its functionality as seen in this post: http://forum.chibios.org/phpbb/viewtopic.php?f=2&t=872.

This method is working fine in my custom board with ARM Cortex M3 STM32F0 using SD3 (USART3), but when I use it in SD5 (UART5) this method doesn't work.

Configuration for both drivers.

Code: Select all

static SerialConfig SERIALtestcfg = {
  57600,
  0,
  USART_CR2_STOP1_BITS | USART_CR2_LINEN,
  0
};


Code: Select all

static WORKING_AREA(myThreadWorkingArea, 128);
 

__attribute__((noreturn))
static msg_t myThread(void *arg) {
  (void)arg;
  chRegSetThreadName("radio");
  EventListener elRadio;
  chEvtRegisterMask((EventSource *)chnGetEventSource(&SD5), &elRadio, 1);
  while (TRUE) {
    flagsmask_t flags;
    chEvtWaitOne(1);

    chSysLock();
    flags = chEvtGetAndClearFlagsI(&elRadio);
    chSysUnlock();
    chprintf((BaseSequentialStream *)&SD3, "Flags %d\r\n",
       (uint16_t)flags);
    if (flags & CHN_INPUT_AVAILABLE) {
      palTogglePad(GPIOD, GPIOD_LED);
      int32_t c = 0;
      while (c != Q_TIMEOUT) {
   c = chnGetTimeout(&SD5, TIME_IMMEDIATE);
      }
    }
}


When there is input in SD3, the flag is

Code: Select all

CHN_INPUT_AVAILABLE
, but SD5 doesn't outputs any flags with the same code that works in SD3.

Any help regarding this?

Thanks :D

Re: Serial Driver Input for Events Error

Posted: Tue Mar 19, 2013 8:53 am
by Giovanni
Hi,

All the drivers use a shared code for generating event flags, I can't find any reason for SD5 to not work exactly like SD3. Are you sure everything else is equal?

Giovanni

Re: Serial Driver Input for Events Error

Posted: Tue Mar 19, 2013 4:28 pm
by erwinkendo
All code working now in all the UART devices. Checked several times, as it is usual, some pin confusion.

This events information is very usefull but it was really a pain to find it, it would be nice to have an example like this documented somewhere else, but for the mean time this will do.

Thanks :)