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.
Hi Anthony,
I got a strange problem. I want use GIOB[2] as a input. But I can not got the value of this pin.
For GIOB[2], I have gated off the Emif_CLK in HCG(HALCoGen 03.05.02). I changed the level of the pin through hardware and read the value by the code showed below, but it did not change. Because this is a specific, I maybe make some mistakes.
Would you help me to find the problem.
void gioInit(void)
{
/* USER CODE BEGIN (2) */
/* USER CODE END */
/** bring GIO module out of reset */
gioREG->GCR0 = 1U;
gioREG->INTENACLR = 0xFFU;
gioREG->LVLCLR = 0xFFU;
/** @b initialize @b Port @b A */
/** - Port A output values */
gioPORTA->DOUT = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port A direction */
gioPORTA->DIR = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port A open drain enable */
gioPORTA->PDR = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port A pullup / pulldown selection */
gioPORTA->PSL = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (1U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port A pullup / pulldown enable*/
gioPORTA->PULDIS = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (1U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** @b initialize @b Port @b B */
/** - Port B output values */
gioPORTB->DOUT = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port B direction */
gioPORTB->DIR = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port B open drain enable */
gioPORTB->PDR = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port B pullup / pulldown selection */
gioPORTB->PSL = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (1U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/** - Port B pullup / pulldown enable*/
gioPORTB->PULDIS = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U); /* Bit 7 */
/* USER CODE BEGIN (3) */
/* USER CODE END */
/** @b initialize @b interrupts */
/** - interrupt polarity */
gioREG->POL = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (1U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U) /* Bit 7 */
| (0U << 8U) /* Bit 8 */
| (0U << 9U) /* Bit 9 */
| (1U << 10U)/* Bit 10 */
| (0U << 11U)/* Bit 11 */
| (0U << 12U)/* Bit 12 */
| (0U << 13U)/* Bit 13 */
| (0U << 14U)/* Bit 14 */
| (0U << 15U)/* Bit 15 */
/** - interrupt level */
gioREG->LVLSET = 0U /* Bit 0 */
| (0U << 1U) //* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (0U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U) /* Bit 7 */
| (0U << 8U) /* Bit 8 */
| (0U << 9U) /* Bit 9 */
| (0U << 10U)/* Bit 10 */
| (0U << 11U)/* Bit 11 */
| (0U << 12U)/* Bit 12 */
| (0U << 13U)/* Bit 13 */
| (0U << 14U)/* Bit 14 */
| (0U << 15U)/* Bit 15 */
/** - clear all pending interrupts */
gioREG->FLG = 0xFFU;
/** - enable interrupts */
gioREG->INTENASET = 0U /* Bit 0 */
| (0U << 1U) /* Bit 1 */
| (0U << 2U) /* Bit 2 */
| (0U << 3U) /* Bit 3 */
| (0U << 4U) /* Bit 4 */
| (1U << 5U) /* Bit 5 */
| (0U << 6U) /* Bit 6 */
| (0U << 7U) /* Bit 7 */
| (0U << 8U) /* Bit 8 */
| (0U << 9U) /* Bit 9 */
| (0U << 10U)/* Bit 10 */
| (0U << 11U)/* Bit 11 */
| (0U << 12U)/* Bit 12 */
| (0U << 13U)/* Bit 13 */
| (0U << 14U)/* Bit 14 */
| (0U << 15U)/* Bit 15 */
/* USER CODE BEGIN (4) */
/* USER CODE END */
}
uint32 keybufferL;
...........
void main (void)
{
/* USER CODE BEGIN (3) */
/* user_ initialization */
rtiInit();
gioInit();
.........
keybufferL = 0;
/*user main loop*/
while(1)
{
......
keybufferL = gioGetPort(gioPORTB);
......
}
/* USER CODE END */
}
Thanks,
B.Rs,
Chuan
Chuan,
Most likely - this is due to GIOB[2] being available on 2 different pads:
There is an input multiplex selection register that controls which pad drives GIOB[2].
The mux is described on page 228 of SPNU499b:
Most likely if you see the GIOB[2] state changing in the pin but not in the memory mapped DIN register, then this mux is set wrong for your application.
Hi Anthony,
Thanks for your reply.
My input signal is connected to pin142 of rm48l952pge and I left pin55 empty, so this pin142 just be used as a input terminal. Would you tell me how I can read the pin142 . May I read the pin55 terminal by current Setting?
Would you tell me which document your information came from. I can find them from RM48L952 datasheet and I can not find the document Spnu499b.
Thanks,
B.Rs,
Chuan
Chuan,
Sorry, for RM48L952, the equivalent document is SPNU503B. That is the TRM for the RM48 series.
Pin 142 is the default for GIOB[2] so you should be ok reading from this pin, unless you have changed the default somewhere (e.x. in a HalCoGen configuration).
EDIT: We noticed an error in the TRM description for GIOB[2]; it lists PINMMR29[16] twice where this isn't true.
The truth table for the input mux selection of GIOB[2] (reorganized slightly) should look like this:
Thanks to Sunil Oak for catching this.
Hi Anthony,
Thanks for your reply.
I just setup the GIOB2 like normal GIO in HALCoGen. The detail will be showed below.
1. Enable GIO driver in "DRIVER ENABLE"
2. Enable GIOB peripheral, enable "use giob_2 for disabling selection HET2 PMW output" and connected the GIOB2 at pin55 in PINMUX. ------------I THINK THE RED MARKER MUST BE MY MISTAKING. If I should not connect the GIOB_2 at pin55 line for using the pin142?
3. setup the GIOB_2' direction, push up and interrupt (GIOB have not the interrupt, but the code which is generated by HALCoGen still have related process code of the GIOB interrupt. Is there some way which can perform the interrupt functions of GIOB ? )
That is all.
May I read the document of SPNU503B? If the answer is yes, Would you send the link to me?
I can not found the document on Ti's web.
Thanks you very much.
B.Rs,
Chuan
Hi Chuan,
First though the TRM / SPNU503B is linked here. Also you can always search for keyword 'spnu503' at www.ti.com. Just make sure it's a keyword search not a part # search.
#1 is fine.
#2 - This: "use giob_2 for disabling selection HET2 PMW output" and connected the GIOB2 at pin55 " is for something else. See below if you want to understand but it's not part of the GIOB[2] pin location choice.
I think the problem is like you said - you shouldn't have PIN 55 set ot GIOB[2] if you want GIOB[2] to read from pin 142. I think this can get confusing because you'd like to see GIOB[2] on this pinmux sheet, but it's the only function for pin 142 therefore pin 142 isn't listed on the PINMUX page in HalCoGen..
Please double check the PINMMR registers 9 and 29 when your code runs though - to make sure they are like the previous post says. That I think is more direct than looking at the generated code.
#3 GIOB does have interrupt capability; I also see it show up in HalCoGen. I'm not sure I understand the problem/question. Would you please explain more?
Thanks and Best Regards,
Anthony
-------
#2 again - this is what the "use giob_2 for disabling selection HET2 PMW output" and connected the GIOB2 at pin55 " is for...
HI Chuan,
I had a similar problem with GIOB[2] PGE package. Look on the thread below:
http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/262129/916660.aspx#916660
In my case the silicon was working opposite (it was older) to the emulation device TI was using to develop the code.
Regards, Dmitri.
Hi Anthony,
Before your last post, I just read the SPNU499. So I thought the GIOB have not interrupt. The PSNU503B is a right document.
I have tried to remove the GIOB form PIN55 in HalCoGen, but nothing be changed in the code.
I read the code which was generated by HalCoGen. the pinmmx9 and pinmmx29 were setup in "void muxInit(void)".
It is showed below.
pinMuxReg->PINMMR9 = (~(pinMuxReg->PINMMR9 >> 18U) & 0x00000001U ) << 18U| PINMUX_PIN_54_HET1_31 | PINMUX_PIN_55_MIBSPI3NCS_0;
pinMuxReg->PINMMR29 = 0x01010101U;
Form the setup. The pinmmr9[18] (GIOB2) is reversed. If it's initial value is "1". After the Muxinit(), it will be cleared to '0". The pinmmr29[16] is setup to "1". According to "The input to a module comes from the dedicated pad when the condition [ not(A) or (A and B) ] = TRUE."(from page 221 of SPNU503B), A = pinmmr9[18], B= pinmmr29[16]. So not(A) =true or (A and B) = false, that means GIOB2 should come from pin142. But it still do not works. The register is showed below. I found there is a error in register Srs of GIOB which is " UNABLE TO READ". Do you know what is problem here.
PINMMR9[18] and PINMMR29[16]:
GIOB Register: I connect "GND" to pin142, but the Din[2] =1
At the table 4-16 in page 234 of SPNU503B, the pinmmr29[16] instead of the pinmmr9[18]. and at the table 4-1 in page 221 of SPNU503B, the pinmmr29[16] also stead of the pinmmr9[18] in column of "Control Register Bit A". If does the GIOB2 connect to pin 142 only be controlled by pimm29[16]?
If that is not true, I do not understand the initial setup of pinmmr9[18]. Why does pinmmr9[18] be reversed in the Muxinit()?
Thanks,
B.Rs,
Chuan
Chaun,
I think Dmotri is probably right - there is an errata item for silicon revision A but I can't find the silicon revision A erratta on our website to point you to the document.
The errata for this silicon revision says that after reset, GIOB[2] input comes from pin 55 instead of pin 142 like it should.
The workaround - if you want it to come from pin 142 is to clear PINMMR29 bit 16.
In your screenshot I can see this bit is set.
Now this is where it can get confusing. The document SPNS503 is applicable to revision B, C silicon.
(The state table posted in the earlier mail).
But if you have Revision A silicon - which I'm guessing that you probably do, then you have to clear bit 16 of PINMMR29 like the errata for Rev A states.
You can tell if you have Rev A silicon like this.
On top of your part, you should see the part number like 'RM48L952PGE".
If you don't see a "B" or "C" (I think it should be between the 2 and the P, like RM48L952BPGE) then you have Revision A silicon and you need to clear PINMMR29 bit 16.
If you're not sure you could try taking a photo of the top of your part and posting it. Then we can confirm the revision for you (as long as the text is visible).
Sorry, one of my colleagues who's paying attention just told me that this may not be a reliable way to find your silicon revision.
I'll have to find out the correct method and get back to you. Meantime you might try clearing bit 16 of PINMMR29 just to see if it works.
Hi Anthony,
Works,
The problem that was caused is that I selected the "Use GIOB_2 for disabling selected HET2 PWM outputs".
In the MuxInit(), the last step is handle the option. So I have to remove the option so that I can clear the PINMMR29[16].
Then I can change the PAD55 or PAD142 connect to GIOB2 by PINMMR9[18].
So I think the "PINMMR29[16]" should be replaced into "PINMMR9[18]" in TABLE 4-1and TABLE 4-16 of SPNU503A/B, because the "PINMMR9[18]" was set independently after the "PINMMR29[16] was cleared to "0".
If the "PINMMR29[16] was set to "1", I can not change the "PINMMR9[18].
Like you said, a errata in SPNZ172A is "DEVICE#139 — Input multiplexing for GIOB[2] is incorrect" for revision A and B. This is not a problem, because I will set this bit in initial code anyway.
My question is :
Q1: By the testing, the PINMMR29[16] seem to be more high prior then PINMMR9[18]. If this is true, the ruler of 4.3.2 section in SPNU503A/B(showed below) will not be correct. If there is priority between the control register bit A and B for controlling multiplexed input.
A indicates the control register bit to be set to enable the corresponding signal to be output on the multiplexed pin. B is another control register bit that is used to select between the dedicated input terminal and the multiplexed pin. • The input to a module comes from the multiplexed pin when the condition [ A and not(B) ] = TRUE. • The input to a module comes from the dedicated pad when the condition [ not(A) or (A and B) ] = TRUE.
Q2: If I can read the MCU silicon revision ID in code for reducing errors that are not compatible in difference revision. For example, I have set some bit in revision A and clear same bit in other revision.
Thanks,
B.Rs,
Chuan
Hi Dmitri,
Thanks your help.
I have found the reason of my case. I hope it also can help you.
Thanks,
B.Rs,
Chuan
Hi Chuan,
---------------------
Q1:
I'll need to look into this further. Are you saying that
GIOB[2] |
142 |
PINMMR29[16]= 0 |
55 |
{PINMMR29[16], PINMMR9[16], PINMMR9[17]}= 100 |
Should instead be:
GIOB[2] |
142 |
PINMMR29[16]= 0 |
55 |
{PINMMR29[16], PINMMR9[18], PINMMR9[17]}= 100 |
?
----------------------------
Q2:
I posted some information in this design note about how to find the Silicon Revison # for RM4xx devices here:
Covers both visual and through software methods.
Hi Anthony,
Thanks for your reply.
For Q1. Yes , and The control register A or B should have a priority.
For example:
1. If A=0 B= x --------for dedicated input pin
2. if A=1 B=1 --------for function 1
B=0 ---------for function 2
I have a Silicon Errata of RM48X MCU.
4137.Silicon Errata_spnz172a.pdf
Q2. ok, I got it.
Thank you very much.
B.Rs,
Chuan