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.
Part Number: TMS320F28335
please can one explain me the reason behind all that conversion and motive behind it.
thanks in advance
This looks like an example from the MW package, can you clarify which example this is coming from? Have you also posted on the MW forum, this appears to be their example code.
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to MatthewPate:
yes this is a matlab example on offset computation with hall sensor (open_system('mcb_pmsm_hall_offset_f28069m.slx');).
I am completely new to 28335,so can u please explain me about GPADAT.all and the reason for and operation with 0x7000000.
In reply to saichand sunkara:
GPADAT is both a read/write register that shows the state of the GPIOA 0-31 but can also be used to change the state of those GPIOs when written to. I would refer to the F2833x TRM Section 1.4 for more information on the register sets and their functions.
In terms of the AND 0x70000000, it appears that the MW code is reading something from the GPIOA bus, but only keeping bits GPIO28-30 to store in the on-chip memory.
Thank you for your response Mr. Matthew pate
And operation is performed with 0x07000000 to all gpio data May I know how did you determine that gpio 28-30 were selected . If I want to select 34-37 then I should be performing with which hexadecimal no?
Thanks in advance
It looks like I mis-read the screen image you posted, and the AND is 0x07000000 as you pointed out. So in this case the MW code is keeping bits 24-26, essentially the GPADAT in this case is GPIO0-31 with each bit representing the state of the GPIO##.
For higher GPIOs, as you mentioned 34-37, these are on the GPBDAT register. The C28x is a 32-bit CPU so you'll see the largest register group is usually a long, i.e. 32-bit.
Thank you for response.
please can you mention the hexadecimal number one should be to read data from any random pin like 45,38 or any.
thank you for your patience and help in making me understand can you just please answer this above question and it would resolve my entire concept on this.
Can you comment on the HW board you are using externally? Is this a TI reference design(if so please copy the link to the page on TI.com)? We would need to look at the schematic to see what is attached to these GPIO pins to understand what kind of data is coming across.
In terms of any GPIO if it is forced to 3.3V(high) the corresponding GPxDAT bit will read a "1". If the GPIO is forced to ground(0V) then it will read a 0.
In the above MW block there must be some variable data/signal on these IO pins that will influence the code.
I beg your pardon for late response. As u suggested me to go through sprui07 i have been lately going through it, this really helped me understand about GPIO and its control registers and all of your previous answers are making a lot more sense now.the matlab example is trying to read the signals coming off of hall sensors on to Ecap modules at GPIO 24 25 26 ecap1 ,ecap2 and ecap3 respectively with GPAMUX2 bits set to 01.Even i understood about GPADAT it defines the state of pin 0 for low and 1 for high and it can also change the state of pin if it is configured as GPIO output .
But all i couldn't understand is the GPIO pins 24 25 26 are used as Ecap to read hall sensor signals which will be a grey code of 1 3 2 6 4 5 or 5 4 6 2 3 1 for CW and CCW rotation of motor respectively hence signal at each pin will be high for 180 deg ,low for rest 180 deg and 120 phase shift between each pin signal.
"So if we are masking the GPADAT.ALL with 0x07000000, it will set GPIO pins 24 25 26 always high irrespective of hall sensor signals and wont be able to read the change in hall sensor signals." this statement is all what i concluded my self but i feel iam wrong so can u please clear me with this misconception.
Tool/software: Code Composer Studio
in a matlab simulink example to read the signals off of hall sensors ,eCAP 1,2 and 3 are used located at gpio 24 25 and 26 with GPAMUX2 BITS SETS TO 01. The data register of port A i.e, GPADAT.all is AND operated with 0x07000000.I am confused with this operation if we perform AND on GPADAT.ALL with 0x07000000 pin no 24 25 and 26 are having binary equivalent equal to 1 and rest all pins have 0, if they are always set to 1 how can they detect change in hall signals because hall signals generate a grey code so signal from each hall sensor will be high for 180 deg and low for another 180 deg. the example which i mentioned is offset calculation of hall sensors matlab example : open_system('mcb_pmsm_hall_offset_f28069m.slx');
I really appreciate you investigating this further, as to what the meaning of these pins in the system is.
In this case the MW team is using the AND of 0x07000000 to only read GPIOs 26-24 when they get the whole GPIO bus. If the GPIO is set it will come through, if not it will stay cleared, all other GPIOs will be ignored which is correct.
You'll notice in the next block there is a shift right of 24 bits, to get these 3 bits in the LSB of the variable.
I noticed that there is a new post around this same topic, I'm going to merge it here to keep the info in the same place.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.