Serial Driver Input for Events Error

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
erwinkendo
Posts: 14
Joined: Wed Apr 25, 2012 4:44 am

Serial Driver Input for Events Error

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Serial Driver Input for Events Error

Post 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
erwinkendo
Posts: 14
Joined: Wed Apr 25, 2012 4:44 am

Re: Serial Driver Input for Events Error

Post 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 :)
Post Reply