PE generated RTC_Enable(NULL) issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PE generated RTC_Enable(NULL) issue

483 Views
neilhancock
Contributor IV

I seem to have come across an issue in KDS 1.1.0 with RTC_LDD component.

Am I missing something?

 

My target is MK20DX50 on FRDM-K20D50, and I've add component RTC_LDD.

It requires the RTC1 to be enabled, and in ComponentInspector.Methods, I click Enable - GenerateCode

The code it generates in RTC1.c looks like it is cut and pasted from another module and can;t work.

If I use RTC1_Enable(NULL); then it will use the NULL pointer without checking it.

If I try and create a  RTC1_TDeviceDataPtr its not declared in an available .h file

 

Instead I use

  RTC_PDD_EnableCounter(RTC_BASE_PTR, PDD_ENABLE);

which works.

 

RTC1.c:

LDD_TError RTC1_Enable(LDD_TDeviceData *DeviceDataPtr) {

  RTC1_TDeviceDataPtr DevDataPtr = (RTC1_TDeviceDataPtr)DeviceDataPtr;

 

  /* Device clock configuration test - this test can be disabled by setting

     the "Ignore speed mode test" property to the "yes" value in the "Configuration inspector" */

  if (!DevDataPtr->EnMode) {           /* Is the device disabled by user? */

    return ERR_SPEED;                  /* If yes then error */

  }

  RTC_PDD_EnableCounter(RTC_BASE_PTR, PDD_ENABLE);

  return ERR_OK;

}

Labels (1)
Tags (3)
0 Kudos
3 Replies

345 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

hello Neil,

can you please specify:

"The code it generates in RTC1.c looks like it is cut and pasted from another module and can;t work.

If I use RTC1_Enable(NULL); then it will use the NULL pointer without checking it." ?

to avoid any misunderstanding , please specify your question with your demo project.

how to see your problem with project step by step, thanks!

Best Regards,

Zhang Jun

0 Kudos

345 Views
neilhancock
Contributor IV

Hello Zhang

I thought I had done what you asked for as a code snippet - but if you can't see a problem, I don't really care, as I have a workaround, just trying to point out what seems to me an error

If I enable the RTC with

RTC1_Enable(NULL);

I believe it will use the NULL pointer in a problem access.

I can't set up a valid pointer, as the RTC1_TDeviceDataPtr is in the RTC1.c file.

In the inspector - there isn't a " the 'Ignore speed mode test" property to the "yes" value in the "Configuration inspector" '

U2.jpg

0 Kudos

345 Views
neilhancock
Contributor IV

So maybe this is what you are asking - i thought it would be obvious -

From KDS 1.1.0 I component library - Alphabetical - clock on RTC_LDD. then alt-click to ADD to Project. Now I did it about a week ago and regenerated code a number of times for other components.

From Project Inspector, click on  ProcessorExpert.pe - Alt-Click and select  "Generate Processor Expert Code"

0 Kudos