McuOnEclipse Components: 22-Mar-2015 Release

There is a new release of the McuOnEclipse components available on SourceForge, with the following main changes:

  1. Shell: Fixed and improved history handling.
  2. MinIni: Option to select local/stack or global memory for buffers
  3. FreeRTOS: Ability to use the tick counter instead of dedicated timer for performance measurement.
  4. FSL_USB_Stack: Added deinitialization for USB stack.
  5. FatFsMemSDHC: added custom card detection and write protection pin handling.
  6. Multiple Bug Fixes
SourceForge McuOnEclipse

SourceForge McuOnEclipse

Shell with History

There has been some problems with the Shell history implementation (introduced in “McuOnEclipse Components: 03-Feb-2015 Release“). The problem was that using non-isalnum() character was in conflict with commands using e.g. ‘:’ as part of their commands. I have changed it now so an explicit character for ‘next in history’ and ‘previous in history’ has to be specified:

Shell with History Characters

Shell with History Characters

The defaults are ‘\t’ (TAB) and ‘\e’ (SHIFT+TAB).

MinIni Buffer Selection

The MinIni component (see “FRDM with Arduino Ethernet Shield R3, Part 4: MinIni“) is an embedded and tiny implementation of .ini files as they exist on Windows with FatFs. The component is using buffers which are allocated by default on the stack. But for large buffers needed, that might blow up the stack on tiny memory systems. Based on the feedback of [rdmeneze], I have added a setting where you can select if the buffer is on the stack or in global memory:

Global Buffer Setting for MinIni

Global Buffer Setting for MinIni

Depending on that setting, it configures a define in minIni.h:

#define INI_USE_GLOBAL_BUFFER   1 /* 0: use stack for buffer; 1: use global memory for buffer */

Of course using global memory will make it non-reentrant. But if this is not a problem for your application, then this setting can help you to reduce your needed stack size.

FreeRTOS Performance Counter can use the RTOS Tick Counter

FreeRTOS has a cool feature to measure the time spent in each task (Runtime Stats). E.g. using the Shell component, it reports the time spent in each task, similar to a task manager/viewer:

--------------------------------------------------------------
RTOS RUN-TIME STATISTICS:
Name        Time    %Time
--------------------------------------------------------------
Shell          177        <1%
IDLE           193466     99%
App            189        <1%

However, this requires usually to measure the time with a dedicated timer (usually 10x faster than the tick timer). I have now added a setting to the FreeRTOS to use the tick counter for this: less exact, but does not need a dedicated timer. In my findings, that tick counter value is enough especially if the tick frequency is rather high, e.g. 1 kHz.

USB Stack Deinitialization

In order to properly shut down and disable USB interrupts, the main USB component and the sub components have now a Deinit() method:

USB Deinit

USB Deinit

The USB1_Deinit() method will call the sub-component deinitialization method (e.g. CDC1_Deinit().

/*
** ===================================================================
**     Method      :  USB1_Deinit (component FSL_USB_Stack)
**     Description :
**         Deinitializes the driver
**     Parameters  : None
**     Returns     :
**         ---             - Error code
** ===================================================================
*/
uint8_t USB1_Deinit(void)
{
  uint8_t err;

  USB1_usb_int_dis(); /* disable USB interrupts */
  /* Initialize the USB interface */
  err = CDC1_Deinit();
  if(err != ERR_OK) {
    /* Error deinitializing USB Class */
    return ERR_FAILED;
  }
  return ERR_OK;
}

FatFsMemSDHC Pin Handling

If an SDHC SDcard hardware wiring is not providing the card detect (CD) and/or write protection (WP) pins, it was possible to disable these pins in the component.

FatFsMemSDHC

FatFsMemSDHC

However, it was not possible to specify what the functions should return. Now if the pins are disabled, it is possible to specify what should happen:

Card Detection and Write Protection Functions

Card Detection and Write Protection Functions

  • FALSE: the function returns always FALSE
  • TRUE: the function returns always TRUE
  • Custom function name: Instead ‘TRUE’ or ‘FALSE’ a function name can be provided, which needs to match the following prototype:
    bool funName(void);
    With that method it is possible to implement a custom function in the application code which provides the greatest flexibility.

Bug Fixes

Several bug fixes has been implemented:

  • Wait: Fixed Waitus() and Waitns() for Kinetis if using different core and bus clock speed.
  • FreeRTOS: fixed port macros for legacy Freescale ARM compiler
  • Shell: fixed hardcoded utility module reference.
  • FatFSMemSDHC: fixed wrong condition order with disabled CD and WP pins

Summary

Several new features and bug fixes has been included into that new release. The new components are available on SourceForge: https://sourceforge.net/projects/mcuoneclipse/

Happy Componenting 🙂

 

 

Advertisements

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.