DAC_LDD issue with SetBufferSize() on K60 tower

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

DAC_LDD issue with SetBufferSize() on K60 tower

Jump to solution
1,515 Views
ScottW
Contributor II
I think there is an issue with the generated SetBufferSize() function for the DAC_LDD bean on the K60 tower; I think it's setting the DACx_C2.DACBFUP bits to the wrong value (specifically, off-by-one). I added the DAC_LDD bean to my project, turned the Data Buffer property to "Enabled" and then changed the SetBuffer() and SetBufferSize() method settings to "Generate Code". In the generated DA1_Init() function it sets the DACBFUP bits to 0xF, since I left the buffer size at the default of 16. However, if I call DA1_SetBufferSize() with a buffer size of 16, it ends up setting these bits to 0x0. DA1_SetBufferSize() doesn't flag this as an error (it passes the if(Size > DA1_BUFFER_MAX_SIZE) test) but then it calls DAC_PDD_SetBufferSize() where the parameter gets masked with DAC_C2_DACBFUP_MASK (which is 0xF) which zeroes out DACBFUP. Is this an off-by-one error with the generated code? It seems like it should be subtracting one before passing the parameter to DAC_PDD_SetBufferSize(), since the DAC's buffer read pointers are zero-based.
0 Kudos
1 Solution
1,265 Views
ProcessorExpert
Senior Contributor III

Hello,

 

the fix of your probelm has been already published within the Udpate #2 V1.0.1 for CW MCU V10.1. To download the update please follow this link: Update #2 V1.0.1

 

best regards
Vojtech Filip
Processor Expert Support Team

View solution in original post

0 Kudos
2 Replies
1,265 Views
ProcessorExpert
Senior Contributor III

Hello,

 

you are completely correct. However this problem has been already fixed in the Update#2 V1.0.1 for Code Warrior V10.1, where you can find exactly the code that you proposed to fix this issue in your post to subtract one before passing the parameter to DAC_PDD_SetBufferSize().

 

DAC_PDD_SetBufferSize(DACx_BASE_PTR,Size - 1U);

 

So the Update#2 V1.0.1 fixes this issue. Unfortunately it is currently not available yet, but as far as I know it should be published within several days. I will update this thread when it will be ready to ensure that you will be properly informed about this release availability.

 

For now as the workaround you have to freeze the generate code ("Code Generation" menu command in the component´s pop-up menu) and change it manually or you can pass value subtracted by one to this function.

 

We are sorry for the inconvenience ...

 

best regards
Vojtech Filip
Processor Expert Support Team

 

0 Kudos
1,266 Views
ProcessorExpert
Senior Contributor III

Hello,

 

the fix of your probelm has been already published within the Udpate #2 V1.0.1 for CW MCU V10.1. To download the update please follow this link: Update #2 V1.0.1

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos