This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hi,
I have to integrate sine cosine encoder of PMSM motor to launchpad f28069m ,I found the header file and library file in control suit.The code provided is for F28379D. How can i change the code to read the sine cosine signal from 2 Adc channels without the index signal.
Thankyou
Shameer,
It's fairly complicated. We have not implemented a sincos solution on F28069 yet, and it is not a scheduled project as of today. It should be possible to modify the code, but there are some hardware factors which make it challenging.
The code in the controlSUITE example was written to run on an F28377D controlCARD with an IDDK board. This device architecture has multiple ADCs, each with separate comparator connections. This allows simultaneous sampling of the sin/cosine pair in parallel with routing both signals through diferent comparator sub-systems and on to the QEP module via the output Xbar.
The F28069 has a different architecture with a single ADC with two S&H modules. We can still sample the sin/cosine pair simultaneously, however the comparator allocation is such that only the A channels go to the non-inverting comparator input. We need sine & cosine signals to be sampled together, and to be routed to the non-inverting inputs of different comparators (because the offset DAC is regulated in the library). The comparator outpus must then be routed to a QEP module. There is no Xbar on F28069 so you will have to make the connections on your board.
You'll have to make an analog channel selection which takes the sine(cosine) signal into an A-side channel, then connects the cosine(sine) signal to an A-side channel for a different comparator AND a B-side channel for simultaneous sampling by the ADC. The comparator outputs would come out on GPIO pins and be routed on your board to the A & B input pins of one of the QEP modules.
Once you have all this done, you'll have some work to do on the code. In "sincos.c" you'll need to change the GPIO, PWM, QEP, and ADC initialization to match the different device, as well as similar changes to the sincos() function in the same file. There is nothing in the library which is device dependent, so with these changes it should run.
I recommend reading carefully through the sincos library user's guide before you begin, so you are absolutely clear how it works.
Regards,
Richard
If you want to use the angle from sin/cos encoder to implement sensored-FOC without using the angle of estimator, it's better to use lab12b as a reference, lab12b used the angle of QEP encoder implement sensored-FOC.
You can write your own code to get the angle from sin/cos encoder to replace below line code.
// compute the electrical angle
ENC_calcElecAngle(encHandle, HAL_getQepPosnCounts(halHandle));
And then replace ENC_getElecAngle(encHandle) with the angle from SIN/COS encoder.
// run the controller
CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData,ENC_getElecAngle(encHandle));