Page 1 of 1

TM-Subsystem / SD-Card / STM32F0 / unknown type name 'halrtc

Posted: Sat May 03, 2014 6:41 am
by Ramazzukk
Hi there,

I am trying to use a SD-Card / FatFS with the STM32F0-Discovery-Board. Since there is no demo, I copied the relevant Code from the F107 Olimex demo. Part of the code is working (I can read at least the filenames from the card), but I don't understand the usage of the TM subsystem.

If I activate the TM subsystem at halconf (like it is in the F107-demo), the compiler gives me an error: unknown type name 'halrtcnt_t'. I compared the makefiles and conffiles an can not figure out what i'm missing.

I guess the TM subsystem is needed for this:

Code: Select all

static void tmrfunc(void *p) {
  BaseBlockDevice *bbdp = p;

  chSysLockFromIsr()
  ;
  if (cnt > 0) {
    if (blkIsInserted(bbdp)) {
      if (--cnt == 0) {
        chEvtBroadcastI(&inserted_event);
      }
    }
    else
      cnt = POLLING_INTERVAL;
  }
  else {
    if (!blkIsInserted(bbdp)) {
      cnt = POLLING_INTERVAL;
      chEvtBroadcastI(&removed_event);
    }
  }
  chVTSetI(&tmr, MS2ST(POLLING_DELAY), tmrfunc, bbdp);
  chSysUnlockFromIsr();
}


Do I have to switch on another part (mcuconf or somewhere)? Any guidance is greatly appreciated beforehand!

Re: TM-Subsystem / SD-Card / STM32F0 / unknown type name 'ha

Posted: Sat May 03, 2014 8:16 am
by Giovanni
The TM subsystem is not supported on the M0 CPUs because they lack the RT counter register.

Anyway, it is not needed in your case, that code uses virtual timers which are unrelated to TM.

Giovanni

Re: TM-Subsystem / SD-Card / STM32F0 / unknown type name 'ha

Posted: Sat May 03, 2014 10:52 am
by Ramazzukk
Hi Giovanni

Thank you very much for your quick response!

Re: TM-Subsystem / SD-Card / STM32F0 / unknown type name 'ha

Posted: Sun May 04, 2014 5:04 pm
by Ramazzukk
Hi there again,

Maybe its very simple, but im struggling to understand following section:

Code: Select all

static void tmrfunc(void *p) {
  BaseBlockDevice *bbdp = p;

  chSysLockFromIsr();

  if (cnt > 0) {
    if (blkIsInserted(bbdp)) {
      if (--cnt == 0) {
        chEvtBroadcastI(&inserted_event);
      }
    }
    else
      cnt = POLLING_INTERVAL;
  }
  else {
    if (!blkIsInserted(bbdp)) {
      cnt = POLLING_INTERVAL;
      chEvtBroadcastI(&removed_event);
    }
  }
  chVTSetI(&tmr, MS2ST(POLLING_DELAY), tmrfunc, bbdp);
  chSysUnlockFromIsr();
}


In IOBlock.h is

Code: Select all

#define blkIsInserted(ip) ((ip)->vmt->is_inserted(ip)). 


Then Eclipse points me to three different directions: ioblock.h, mmc_spi.h, mmcsd.h..

How ist blkIsInserted(bbdp) becoming true? I can't figure out..

Thank you for any further guidance..

Re: TM-Subsystem / SD-Card / STM32F0 / unknown type name 'ha

Posted: Sun May 04, 2014 6:01 pm
by Giovanni
Hi,

That macro ultimately calls a function in board.c, the detection method for cards is board-dependent. you need to make sure that your board.c implements that function.

Giovanni

Re: TM-Subsystem / SD-Card / STM32F0 / unknown type name 'ha

Posted: Sun May 04, 2014 7:45 pm
by Ramazzukk
Hi Giovanni,

Thank you for your reply. I've found it now:

Code: Select all

#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/**
 * @brief   MMC_SPI card detection.
 */
bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) {

  (void)mmcp;
  /* TODO: Fill the implementation.*/
  return TRUE;
}

Re: TM-Subsystem / SD-Card / STM32F0 / unknown type name 'ha

Posted: Sun May 04, 2014 8:08 pm
by Giovanni
Yes, that one.

Giovanni