AnsweredAssumed Answered

FOC 4.3 + F303 + GCC + Errors

Question asked by Vladimir Glavnyy on Jun 26, 2017

I use FOC4.3 for my project based on nucleo303+IHM07M1, with GCC compiler.

I found a few errors in the library. May be it can be useful for a MC team or community.

 

1. Invalid ifdef for CCRAM attributes. GCC compiler not taken and ignored.

#if defined (CCMRAM)
#if defined (__ICCARM__)
#pragma location = ".ccmram"
#elif defined (__CC_ARM)
__attribute__((section ("ccmram")))
#endif
#endif

 

This definition can be like this:

#if (defined (CCMRAM) || defined(CCMRAM_ENABLED))
   #if defined (__ICCARM__)
      #pragma location = ".ccmram"
   #elif defined (__CC_ARM)
      __attribute__((section ("ccmram")))
   #elif defined (__GNUC__)
      __attribute__((section ("ccmram")))
   #else
      #errror "Unknown compiler!"
   #endif
#endif

===========================================================================================
2. Precompiled library "libMC_Lib_PS_CM4_CCM.a" does not have "ccmram" or ".ccmram" memory section.
This precompiled code could not be placed to the CCMRAM memory.
This error arase due to previous error in definition of an attribute for the ccmram memory.

===========================================================================================
3. "SystemNDriveParams.h" does not check ADC34 selection for single motor configuration when R3_4_F30X used.
Parameter .bInstanceNbr always equal to 1, and late code try to select ADC1/2 in the "R3_4_F30x_PWMnCurrFdbkClass.c".

/* Assignment of ADC resources for motor phases current measurements*/

if (pDParams_str->bInstanceNbr == 1u)
{
   ADCx_1 = ADC1;
   ADCx_2 = ADC2;
   NVIC_IRQChannel = (uint8_t) ADC1_2_IRQn;
}
else
{
   ADCx_1 = ADC3;
   ADCx_2 = ADC4;
   NVIC_IRQChannel = (uint8_t) ADC3_IRQn;
}


This code can be like this:

 

if (pDParams_str->wAHBPeriph != RCC_AHBPeriph_ADC34)
{
   ADCx_1 = ADC1;
   ADCx_2 = ADC2;
   NVIC_IRQChannel = (uint8_t) ADC1_2_IRQn;
}
else
{
   ADCx_1 = ADC3;
   ADCx_2 = ADC4;
   NVIC_IRQChannel = (uint8_t) ADC3_IRQn;
}


===========================================================================================
4. The file "MP_Settings.h" have a header guard MOTOR_PROFILER
#ifndef MOTOR_PROFILER
#define MOTOR_PROFILER
...
#endif

This definition intersect with common define for MOTOR_PROFILER.

===========================================================================================

 

All other work fine, thanks for FOC team.

IHM07M1 board easy modified for a PGA3/4 with ADC3/44 and can be used with external opams as well.

Attachments

Outcomes