Hello,
I would like to ask for your kind help with some problem involving Vref and GPIO.
I use the Vref voltage internally with a low-power buffer. At the same time, I use GPIO, in particular PTB2. However I see some interference on PTB2 presumably caused by Vref. To test my point, I did a sample program listed below.
I ran this program on my Freedom KL03. I removed R17 that connects PTB2 to the UART of the programming interface.
configure_gpio();
init_vref();
enable=0;
while(1) {
PTB -> PTOR|=0x1<<10; //LED
if(enable) {
PORT_HAL_SetMuxMode(PORTB_BASE_PTR, 2u,kPortMuxAsGpio);
GPIO_HAL_SetPinDir(GPIOB_BASE_PTR, 2U, kGpioDigitalOutput);
GPIOB->PCOR = 0x1 <<2u;
} else {
PORT_HAL_SetMuxMode(PORTB_BASE_PTR, 2u,kPortPinDisabled);
}
enable ^= 1u;
for(j=0;j<1;j++) { //delay
for (i=0;i<150000u;i++) { }
}
}
If I hook the oscilloscope to PTB2, I see an oscillation between 1.2V and 0.4V, which is not what I expect, I would have expected to see an oscillation between 1.2V and 0V. I also used breakpoints to test my point.
Have any of you experienced that problem? any suggestions?
Thank you!
Hi Carlos,
After had a brief look through the statement above, I think I already had an overview of your question.
However I still have some inquiries and want to confirmed with you.
1. After you remove the R17, you can hook the oscilloscope the PTB2 directly and without connect the the UART0_RX-TGTMCU, I think it will be more accuracy.
2. Does the interference still exist after you disable the VREF?
I'm looking forward to your reply.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Jeremy,
Yes, that what I did, I removed R16, R17 and I put the oscilloscope on the Arduino-like headers.
Thank you for looking into this!
-Carlos
Hi Carlos,
I was wondering if you can share the whole demo, then I can reproduce this phenomenon on my board.
I'm looking forward to your reply.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------