Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Legacy microcontrollers Forum Discussions

ThUl_4287856
Employee
Employee
First question asked

Hi,

I think I found a bug in the PDL v2.1.0 in adc.c. There are 2 macro names used that are not defined: FM_ADC0_SCTSL_AVAILABLE and FM_ADC0_PRTSL_AVAILABLE. The correct names, as defined in the s6exxxxx.h files, should be FM_ADC_SCTSL_AVAILABLE and FM_ADC_PRTSL_AVAILABLE respectively (without the "0" after "ADC"). There are 3 lines where one or both macros appear (see diff below).

--- a/PDL/2.1.0/drivers/adc/adc.c

+++ b/PDL/2.1.0/drivers/adc/adc.c

@@ -485,7 +485,7 @@ en_result_t Adc_Init( volatile stc_adcn_t* pstcAdc,

                 return ErrorInvalidParameter;

         }

-      #if defined(FM_ADC0_SCTSL_AVAILABLE)

+      #if defined(FM_ADC_SCTSL_AVAILABLE)

         // Scan Conversion Timer Start Enable and Timer Source

         if (TRUE == pstcConfig->pstcScanInit->bScanTimerStartEnable)

         {

@@ -516,7 +516,7 @@ en_result_t Adc_Init( volatile stc_adcn_t* pstcAdc,

         // Priority external Trigger Start Enable

         stcPCCR.PEEN = (TRUE == pstcConfig->pstcPrioInit->bPrioExtTrigStartEnable) ? 1u : 0u;

-      #if defined(FM_ADC0_PRTSL_AVAILABLE)

+      #if defined(FM_ADC_PRTSL_AVAILABLE)

         // Priority Conversion Timer Start Enable and Timer Source

         if (TRUE == pstcConfig->pstcPrioInit->bPrioTimerStartEnable)

         {

@@ -729,7 +729,7 @@ en_result_t Adc_DeInit( volatile stc_adcn_t* pstcAdc, boolean_t bTouchNvic )

     pstcAdc->WCMRCOT = 0u;

     pstcAdc->WCMRCIF = 0u;

#endif  

-#if defined(FM_ADC0_SCTSL_AVAILABLE) && defined(FM_ADC0_PRTSL_AVAILABLE)

+#if defined(FM_ADC_SCTSL_AVAILABLE) && defined(FM_ADC_PRTSL_AVAILABLE)

     pstcAdc->SCTSL   = 0u;

     pstcAdc->PRTSL   = 0u;

#endif

Best regards,

Thomas

0 Likes
1 Solution
Roy_Liu
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 5 questions asked

This will not be fixed in a new version of PDL(for FMx devices), instead users can refer to the knowledge base article in the following page when using PDL 2.1.0.

Wrong ADC Macro Names Used in adc.c in PDL 2.1.0 - KBA228999

Roy Liu

View solution in original post

0 Likes
3 Replies
Roy_Liu
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 5 questions asked

Thanks for the reporting, will ask the author of the PDL to check and get back to this discussion.

Roy Liu
0 Likes
Amy_Qian
Employee
Employee
10 solutions authored 10 replies posted 5 solutions authored

Hello,

Thank you for your report, we will modify it.

the following grey code is invalid in adc.c, due to FM_ADC0_SCTSL_AVAILABLE do not be defined.

it should be FM_ADC_SCTSL_AVAILABLE defined in header file.

pastedImage_0.png

0 Likes
Roy_Liu
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 5 questions asked

This will not be fixed in a new version of PDL(for FMx devices), instead users can refer to the knowledge base article in the following page when using PDL 2.1.0.

Wrong ADC Macro Names Used in adc.c in PDL 2.1.0 - KBA228999

Roy Liu
0 Likes