Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By HowardHo
#81222 This is an older post but I'm having problems with this.

const int CTSPin = 13; // GPIO13 for CTS input
pinMode(CTSPin, FUNCTION_4); // make pin U0CTS
U0C0 |= UCTXHFE; //add this sentense to add a tx flow control via MTCK( CTS )

Isn't the correct program line:
U0C0 |= 2^UCTXHFE; //add this sentense to add a tx flow control via MTCK( CTS )

Since the bit needs to be set? UCTXHFE is 15 which is the correct bit in the register. Otherwise bits 0, 1, 2, 3 are set, I believe. Where am I going wrong?

User avatar
By JimDrew
#81256 I could never get this to work so I used a different method of polling a pin.

I believe you could be correct though! U0C0|=value. I thought UCTXHFE was a value, not a bit. If it is in fact a bit (15) then yes, this would be OR'ing %0000000000001111 as the value, not %1000000000000000 as intended. I am not much of a 'C' guy though, so I was surprised you could even do |= as an operator.

I might go back and look at this again. Let me know if you try using 2^UCTXHFE and it works. :)
User avatar
By JimDrew
#81275 Thanks for the link. It seems that there are separate Tx and Rx flow control enable bits.

It would be nice to have some example setup code for the Arduino IDE. The Espressif datasheet is for their normal C environment.

By the way, it seems that pin 12 is U0CTS and pin 13 is U0RTS. I don't think that these can be changed from these assigned pins based on the pinout map. Your example above is trying to use pin 13 for CTS.