This article is about the VEX Cortex, which is the legacy microcontroller for VRC and is no longer competitive
The VEX Cortex is the older microcontroller legal for use in VRC. It is a 32-bit ARM Cortex-M3 processor with support for PROS, Easyc, and Robotc. It features ten motor outputs which can deliver up to 8 A combined of current (12 A with a VEX Power Expander), twelve digital inputs/outputs, eight analog inputs, and three communication interfaces.
Large, yet does not break out all pins of the microcontroller core chip
Most powerful chip peripherals are unavailable
The VEX Cortex may be mounted in almost any orientation on the robot using 8/32" bolts. However, it is most convenient to have the ports facing upward and the power switch easily accessible. A USB extension cable should be used to relocate the VEXNet key away from potential sources of interference.
Since the VEX Cortex is the only microcontroller which can run actuators on the robot, all past robots have had one. As of VEX Gateway, the additional functionality of Midnight C (PROS) and more peripherals have been unlocked. PROS has been used to program the VEX Cortex since VEX Sack Attack.
If the VEX Cortex is not working properly, look at the three indicator lights on the Cortex microcontroller. The most common solution is restarting both the VEX Joystick and the Cortex; if the Cortex still fails to operate, downloading the firmware is probably the next step.
Robot battery is dead
Red (fast flash)
Backup battery low or unplugged
Red (slow flash)
User code has crashed
Robot battery is low
Green (slow flash)
Ready to download firmware If not intended, restart the Cortex
Red (slow flash)
VEXNet communications lost
Yellow (slow flash)
Green or Green (+1 blink)
Tethered to PC or joystick
Green (fast flash)
User code running (no competition switch)
Robot disabled, set competition switch to Enable
Green (fast flash)
Green (fast flash)
Green (slow flash)
Code download in progress If stuck in this state, restart the Cortex
Motor ports provide little or no power - The battery is low, or too much power was drawn from the ports, tripping a Resettable Fuse (PTC). Wait a few minutes and try again, or disconnect some motors from the VEX Cortex to lighten the load.
Sensors not working properly - A backup battery should be connected to maintain power to sensors. Sensors work differently when the VEX Cortex is powered from a powered programming adapter or the orange USB A to A cable. Always test sensors with a VEX battery connected and in use.
Code download stops midway - Downloading large files exposes problems with VEXNet. Go through and optimize the program, or download using the USB tether instead of over wireless.
Cortex will not turn off - When a backup battery is connected, turn off the VEX Joystick first and allow the VEX Cortex to lose the connection before powering down to avoid this issue.
If VEX releases a firmware update, or the Cortex is acting in an erratic manner, it is time to reflash the firmware. A valid copy of RobotC is required to reflash the RobotC Firmware; EasyC and Midnight C only requires a Mastercode update, which can be done without EasyC using the VEXnet Firmware Upgrade Utility.
Turn off the Cortex
Connect an orange USB A to A cable to the Cortex USB port and the PC
Use the appropriate Firmware Update command to reflash the new firmware:
RobotC: Use ''Robot > Download Firmware > ROBOTC Firmware > Standard File''
EasyC: Open the ''VEXnet Firmware Upgrade Utility'', select ''Bootload'', answer "Yes" to ''Start Boot Loader?'', and when prompted, click ''Upgrade''
PROS: Use ''VEX > Update Mastercode...'' (Windows only), select ''Bootload'', answer "Yes" to ''Start Boot Loader?'', and when prompted, click ''Upgrade''
The digital, serial, I2C, and analog pins on the Cortex microcontroller are actually given different names by the microcontroller's registers. By mapping these GPIO pins with a test program, the following pin to port map was derived:
Digital 1 - PE9(TIM1_CH1/FSMC_D6)
Digital 2 - PE11(TIM1_CH2/FSMC_D8)
Digital 3 - PC6(TIM3_CH1/I2S2_MCK/TIM8_CH1/SDIO_D6)
Digital 4 - PC7(TIM3_CH2/I2S3_MCK/TIM8_CH2/SDIO_D7)
Digital 5 - PE13(TIM1_CH3/FSMC_D10)
Digital 6 - PE14(TIM1_CH4/FSMC_D11)
Digital 7 - PE8(TIM1_CH1N/FSMC_D5)
Digital 8 - PE10(TIM1_CH2N/FSMC_D7)
Digital 9 - PE12(TIM1_CH3N/FSMC_D9)
Digital 10 - PE7(TIM1_ETR/FSMC_D4)
Digital 11 - PD0(CAN_RX/FSMC_D2/OSC_IN)
Digital 12 - PD1(CAN_TX/FSMC_D3/OSC_OUT)
SP - PA4(USART2_CK/DAC_OUT1/ADC_4)
Analog 1 - PA0(WKUP/USART2_CTS/TIM2_CH1_ETR/TIM5_CH1/TIM8_ETR/ADC_0)
Analog 2 - PA1(USART2_RTS/TIM5_CH2/TIM2_CH2/ADC_1)
Analog 3 - PA2(USART2_TX/TIM5_CH3/TIM2_CH3/ADC_2)
Analog 4 - PA3(USART2_RX/TIM5_CH4/TIM2_CH4/ADC_3)
Analog 5 - PC2(ADC_12)
Analog 6 - PC3(ADC_13)
Analog 7 - PC0(ADC_10)
Analog 8 - PC1(ADC_11)
UART1_TX - PD5(FSMC_NWE/USART2_TX)
UART1_RX - PD6(FSMC_NWAIT/USART2_RX)
UART2_TX - PC10(UART4_TX/SDIO_D2/USART3_TX)
UART2_RX - PC11(UART4_RX/SDIO_D3/USART3_RX)
I2C1_SCL - PB8(TIM4_CH3/SDIO_D4/I2C1_SCL/CAN_RX)
I2C1_SDA - PB9(TIM4_CH4/SDIO_D5/I2C1_SDA/CAN_TX)
By using the second UART peripheral, one can find its RX pin exposed on analog 4 and its TX pin exposed on analog 3. Its CK pin is also exposed on the SP pin. Combined, these pins form an SPI device, with MOSI on analog pin 3, MISO on analog pin 4, and SCK on the SP pin. CS can be performed by any free GPIO on the digital, analog, or communication ports.
The built-in I2C port is linked to I2C1 on its alternate pin mapping. It is used to connect to the VEX Motor Encoders. EasyC, RobotC, and PROS all support use of the port; only PROS allows connection of custom sensors such as gyros as well.
Since the I2C and UART ports are directly connected to the STM32 device without short-circuit or ESD protection resistors, they are more vulnerable to failure or lock-up than the regular Digital I/O. easyC and ROBOTC users of the VEX Motor Encoders have found that static built up from driving on the field can discharge through the motor casing and the IME chain into the Cortex, causing a possible lock-up and crash.
A Digital-to-Analog Converter (DAC) peripheral is exposed on the speaker (SP) port. If this port is not being used for analog input or SPI, an analog voltage can be output on this pin. It ranges from about 0.1 to 3.2 V, but is high-impedance. For practical usage of this pin, an operational amplifier must be used to buffer the output.
Several of the built-in timer modules also have exposed capture/compare pins on the available outputs, possibly allowing a VEX Power Expander to run off of a digital port and increase the number of independent output signals. Sophisticated schemes for PWM output or pulse accumulation/width measurement can also be implemented.
External port details
The Crystal ports and Communications ports are connected directly to their outputs. However, Digital ports have a series 1 Kohm resistance to provide short-circuit protection and a 1 nF capacitor for decoupling, limiting their Slew Rate and Output Drive accordingly. Analog ports have a voltage divider which makes 5 V inputs safe for the 3.3 V ADC with a total input impedance of around 28 Kohms and an anti-aliasing 3dB bandwidth of 16 KHz. A weak pull-up in processor by default makes Digital inputs float high and Analog inputs idle at about 0.2 V. The Speaker port has a 100 ohm series resistor and no capacitor.