I'm trying to enable FEIE on UART0 on a Teensy 3.5, but the board seems to lock up when I set the bit via the bit-band alias region, and I'm having some difficulty figuring out why. Here is a vastly simplified example:
This works fine:
The board becomes unresponsive with this:
For the bit-band alias address: The address for UART0_C3 is 0x4006a006. Subtracting 0x40000000, multiplying by 32, adding 4 (because bit number of FEIE is 1), and then adding 0x42000000 gives 0x42d400c4.
This works fine:
Code:
void setup() {
Serial.begin(115200);
while (!Serial && millis() < 4000) {
}
Serial1.begin(250000, SERIAL_8N2);
UART0_C3 |= UART_C3_FEIE;
Serial.println("Here!");
}
The board becomes unresponsive with this:
Code:
void setup() {
Serial.begin(115200);
while (!Serial && millis() < 4000) {
}
Serial1.begin(250000, SERIAL_8N2);
*reinterpret_cast<uint32_t *>(0x42d400c4U) = 1;
Serial.println("Here!");
}
For the bit-band alias address: The address for UART0_C3 is 0x4006a006. Subtracting 0x40000000, multiplying by 32, adding 4 (because bit number of FEIE is 1), and then adding 0x42000000 gives 0x42d400c4.