Is there any example code on how to access hardware registers on the Teensy 3.6 ?
D Don.Vukovic Member Nov 22, 2019 #1 Is there any example code on how to access hardware registers on the Teensy 3.6 ?
KurtE Senior Member+ Nov 22, 2019 #2 Yes - Take a look at all of the code in core, example on my setup Core files are at: d:\Arduino.1.8.10\hardware\teensy\avr\cores\teensy3\... Example from serial1.c in the serial_begin function. Code: UART0_C1 = UART_C1_ILT; UART0_TWFIFO = 2; // tx watermark, causes S1_TDRE to set UART0_RWFIFO = 4; // rx watermark, causes S1_RDRF to set UART0_PFIFO = UART_PFIFO_TXFE | UART_PFIFO_RXFE; Each of the things like UART0_C1 is a hardware register. A lot (most) of the registers are defined in the file kinetis.h And in many cases you will need to tell the system to give you access to some of these registers. In the above case: Code: SIM_SCGC4 |= SIM_SCGC4_UART0; // turn on clock, TODO: use bitband You can get the datasheets for the different boards up at: https://www.pjrc.com/teensy/datasheets.html
Yes - Take a look at all of the code in core, example on my setup Core files are at: d:\Arduino.1.8.10\hardware\teensy\avr\cores\teensy3\... Example from serial1.c in the serial_begin function. Code: UART0_C1 = UART_C1_ILT; UART0_TWFIFO = 2; // tx watermark, causes S1_TDRE to set UART0_RWFIFO = 4; // rx watermark, causes S1_RDRF to set UART0_PFIFO = UART_PFIFO_TXFE | UART_PFIFO_RXFE; Each of the things like UART0_C1 is a hardware register. A lot (most) of the registers are defined in the file kinetis.h And in many cases you will need to tell the system to give you access to some of these registers. In the above case: Code: SIM_SCGC4 |= SIM_SCGC4_UART0; // turn on clock, TODO: use bitband You can get the datasheets for the different boards up at: https://www.pjrc.com/teensy/datasheets.html