-
-
Notifications
You must be signed in to change notification settings - Fork 726
HardwareSerial BUG Rx pin floating input #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Uart::Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX, SercomRXPad _padRX, SercomUartTXPad _padTX)
{
sercom = _s;
uc_pinRX = _pinRX;
uc_pinTX = _pinTX;
uc_padRX=_padRX ;
uc_padTX=_padTX;
pinMode(uc_pinRX,INPUT_PULLUP);//Rx pin set INPUT_PULLUP mode
} This method is not effective,the program runs to main(), will change the pin mode to INPUT file wiring.c line 87 void init( void )
{
uint32_t ul ;
// Set Systick to 1ms interval, common to all Cortex-M variants
if ( SysTick_Config( SystemCoreClock / 1000 ) )
{
// Capture error
while ( 1 ) ;
}
// Clock PORT for Digital I/O
// PM->APBBMASK.reg |= PM_APBBMASK_PORT ;
//
// // Clock EIC for I/O interrupts
// PM->APBAMASK.reg |= PM_APBAMASK_EIC ;
// Clock SERCOM for Serial
PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ;
// Clock TC/TCC for Pulse and Analog
PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ;
// Clock ADC/DAC for Analog
PM->APBCMASK.reg |= PM_APBCMASK_ADC | PM_APBCMASK_DAC ;
// Setup all pins (digital and analog) in INPUT mode (default is nothing)
for ( ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ )
{
pinMode( ul, INPUT ) ;//change the pin mode to INPUT
} |
@Makeblock-official sorry, I don't understand. |
The RX pin does not have pull-up mode enabled by default to maintain compatibility with the AVR core. Once something like #101 is merged, you'll be able to enable pull-ups for RX0 in your sketch if needed. I'm closing this for now. @Makeblock-official why do you need to enable pull up on RX0? |
RX needs to be INPUT_PULLUP in my opinion because in disconnected state it will pick up noise and also floating pins are very bad for power consumption during sleep (not just bad, but horrible! floating around 100µA instead of 3µA). can someone please pursue this issue. |
Rx pin should be set to the pull-input at begin
fix this bug as follows
file Uart.cpp line 37
file SERCOM.cpp line 118
The text was updated successfully, but these errors were encountered: