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.

  • Resolved

TMS320F28335: GPADAT.all is performed a bitwise and with 0x7000000 and later its went through a arithmetic shifter with the conditions as in screenshot attached can any one explain me the reason behind all of this

Intellectual 260 points

Replies: 18

Views: 185

Part Number: TMS320F28335

please can one explain me the reason behind all that conversion and motive behind it.

thanks in advance

s.chand 

  • Saichand,

    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.

    Best,

    Matthew

    Helpful Links:

    Getting StartedApplication SpecificMore Resources
    C2000 Training Portal Electric Vechicles All C2000 Reference Designs
    C2000 MCU Development Tools Industrial Drives MathWorks Solutions for C2000
    C2000 Home Page Power Control
  • In reply to MatthewPate:

    Matthew,

    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.

    Best regards

    s.chand

  • In reply to saichand sunkara:

    S.chand,

    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.

    Best,
    Matthew

    Helpful Links:

    Getting StartedApplication SpecificMore Resources
    C2000 Training Portal Electric Vechicles All C2000 Reference Designs
    C2000 MCU Development Tools Industrial Drives MathWorks Solutions for C2000
    C2000 Home Page Power Control
  • In reply to MatthewPate:

    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

    S. Chand

  • In reply to saichand sunkara:

    S. Chand,

    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.

    Best,

    Matthew

    Helpful Links:

    Getting StartedApplication SpecificMore Resources
    C2000 Training Portal Electric Vechicles All C2000 Reference Designs
    C2000 MCU Development Tools Industrial Drives MathWorks Solutions for C2000
    C2000 Home Page Power Control
  • In reply to MatthewPate:

    Matthew Pate,

    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.

    best regards

    s.chand

  • In reply to saichand sunkara:

    S. Chand,

    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.

    Best,

    Matthew

    Helpful Links:

    Getting StartedApplication SpecificMore Resources
    C2000 Training Portal Electric Vechicles All C2000 Reference Designs
    C2000 MCU Development Tools Industrial Drives MathWorks Solutions for C2000
    C2000 Home Page Power Control
  • In reply to MatthewPate:

    Matthew Pate,

    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.

    Best Regards

    S.Chand 

     

  • Part Number: TMS320F28335

    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');

  • In reply to saichand sunkara:

    S. Chand,

    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.

    Best,

    Matthew

    Helpful Links:

    Getting StartedApplication SpecificMore Resources
    C2000 Training Portal Electric Vechicles All C2000 Reference Designs
    C2000 MCU Development Tools Industrial Drives MathWorks Solutions for C2000
    C2000 Home Page Power Control

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.