Embedded Coder C2000 ADC Example F280049 Does Not Work

22 vues (au cours des 30 derniers jours)
Sander Rots
Sander Rots le 17 Nov 2021
Commenté : Sander Rots le 25 Nov 2021
Hi everybody,
I am working on a digital control project, for which I have build a custom board containing the F280049C MCU. Currently I'm testing my new board and generating seperate pieces of code to test all the MCU functions seperatelly. The GPIO pins, DAC's, virtual COM port and PWM outputs seem to work fine.
However, I cannot get the ADC's to work. At first I thought this might be due to an hardware flaw on my custom PCB. So I decided to purchase the LAUNCHXL-F280049C and used the same simulink files to generate code for it. The results stay the same: GPIO, DAC, virtual COM and PWM seem to work fine, but the ADC does not!
Therefore I tried the "ADC-PWM Synchronization Using ADC Interrupt" example from the Matworks C2000 documentation.Running the "c28004x_adcpwmasynctest_ert" command to get the correct version for my c280049C launchpad.
The example does not work properly for me. After clicking "Build, Deploy & Start" I connect ADCA0 (pin70 of J7) either directly to GND or 3V3 using a jumper wire. This does not change PWM1A (pin80 of J8), it stays low all the time (I measure it on an oscilloscope). Something weird happens when I push the reset button: Suddenly I am able to measure a PWM signal on pin80 with a dutycycle of 97.42%. Unfortunatelly changing the voltage on the ADCA0 pin does not change anything for the PWM dutycycle, it stays at 97.42%.
I also have a LAUNCHXL-F28379D, so I decided to run the same example using this board. For this I used the "c2807x_2837xx_adcpwmasynctest_ert" command. Again, I connect GND and 3V3 to the ADCA0 input, but now the ouput of EPM1A does change. Switching from roughly 100% dutycycle when connected to GND to almost 0% when connected to 3V3. So the example does work for the F28379 board.
I decided to compare the settings of all blocks in both models, Interupt, PWM, Gain, ADC. They are identical to eachother (other than that the ADC block for the F28379D offers an 16-bit differential input option).
I have no idea why this example (and the ADC in general) does not seem to work for my F280049 Launchpad and custom board. I'm using Matlab R2021a and Code Composer Studio 10.2.0
Has anybody any idea how to fix this problem or what the cause might be?
I am allready far into my Master thesis project, with the custom PCB allready produced, and now I have been stuck with this issue for the last 2 weeks.
Any help or idea's would be greatlly appriciated.
Kind regards, Sander
  2 commentaires
Venkatesh Chilapur
Venkatesh Chilapur le 23 Nov 2021
Hi Sander,
How about other ADC pins? Like J3-30 ADCINA1. Do you see the same issue?
Try debugging the code in CCS and see what values are read inside ADC result register.
HTH,
Regards,
Venkatesh C
Sander Rots
Sander Rots le 25 Nov 2021
Hi Venkatesh,
Thank you for your reply!
Changing from ADCINA0 to ADCINA1 does not change anything for me.
When I open and build the generated code in CSS I do get a lot of warnings: "creating output section " " without a SECTIONS
A picture of this build in CCS below:
In CCS I do not see the fixed PWM1 signal appear when I reset the MCU (unlike when running direcly from Simulink). When I reset the MCU the program jumps to "Estop0", as can be seen below:
When I then terminate the program in CCS the fixed PWM1 signal does appear on my scope, but like before it is fixed and does not react to the voltage on ADCINA1.
I have added the generated code to this reply.
Does this information clearify things for you?
Regards, Sander

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by