# Project Assembly Steps ##### **2.1 Main Block: CAN Controller (can\_controller\_std)** The can\_controller\_std is the heart of the system. It implements the standard CAN protocol (11-bit ID), being responsible for sending and receiving CAN frames on the bus. This block manages communication, organizes data packets, controls message transmission and monitoring, and provides status signals that are used by the rest of the system. **Main Functions:** - Transmit CAN frames with custom data (in this case, the message "HELLO"). - Receive CAN frames from the bus. - Signal transmission and reception interrupts. - Work together with a UART controller to display received data. ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeGieCAvCK4w1NwQm9E2UBIPLT3XkQQ__ZvmU4CS8X2yPNzd7Msc8xOST6gXuAZiDRcdw8IjrdZJxFQePMKagSFREvcenF6QsdJIUzTDmlmCSUvaGyfNtnHEDXc7zpLdGl7VJi62cFxp2D3ziEM4UU?key=tBiA3od2N48C8_l4qPd-3A8p) ##### **2.2 CAN Controller Block Inputs** To function properly, the can\_controller\_std requires different control, configuration, and data signals. Below, we organize these inputs into three categories: main inputs, configuration parameters, and data for the message to be transmitted. ***a) Main Inputs*** These inputs control the basic operation and synchronization of the block.
InputSourceDescription
clk\_iGlobal system clockSynchronizes all internal operations of the CAN controller.
rst\_iInvertedC (reset)Active-low reset that initializes the CAN controller when necessary.
rx\_iPhysical IO70 pinReceives data from the CAN bus (CAN RX).
tx\_request\_ione\_hz\_clock (1 Hz pulse)Requests the CAN controller to transmit a frame every second.
clear\_irq\_iInvertedC from key buttonManually clears transmission interrupts, allowing new transmissions.
![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeWPlCbrz3VtbqPQIHxxXbHTwfPyTTAuuwLa_kXqUr0lm7vdQ5HxRnloU53Fi0e4tBrsErqNR02Js9Kd8cNZOtRk-m2Na9IzZ2PBThD392D38PsTxkQ9zlGvvLlcnjvCgZ0mf1OjM8lz9XB2De93z8?key=tBiA3od2N48C8_l4qPd-3A8p) ***b) Configuration Parameters*** These signals configure the bit timing and message filtering of the CAN protocol. They determine the transmission speed and which messages are accepted on the bus.
ParameterValueDescription
tx\_data\_0\_i8'd72H (first byte of the "HELLO" message)
time\_segment\_1\_i4'd15Defines the first segment of the bit time in the CAN protocol. It controls part of the CAN communication timing, assisting with signal synchronization.
baud\_r\_presc\_i3'd2Prescaler for the CAN protocol clock. Defines the timing base which, together with the time segments, determines the CAN transmission speed. Example: 125 Kbps.
sync\_jump\_width\_i1'b0Defines the Synchronization Jump Width (SJW). With 0, there is no margin for bit time adjustments in case of small variations.
time\_segment\_2\_i2'b01Second time segment in the CAN protocol. Controls the final part of the bit time, important for completing transmission synchronization.
acceptance\_code\_i11'h000Acceptance code for filtering received CAN messages. A value of 000 means any message ID will be accepted (no filtering).
acceptance\_mask\_i11'h000Acceptance mask that defines which bits of acceptance\_code\_i are relevant. With 000, filtering is disabled and all messages are accepted.
![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcE9rrvNyBOGD-unAYqSYxijnE8H2C9_9C1B4CRNTdJo8ffjhIpTtlIdq715z-rVO1oQ6kMYbr5Dd17sTto625N07Bd3aSeJS5Rx2oKZigDyK-CmL3H7kpqVEnAkpSkL3GlSgzaYj4-sqBsx5SVdWY?key=tBiA3od2N48C8_l4qPd-3A8p) ***c) Data to Be Transmitted*** These signals are responsible for loading the information that composes the message transmitted on the CAN bus. In this project, we want to send the string "HELLO", consisting of 5 characters.
SignalValueDescription
rtr\_i1'b0Mensagem de dados normal.
packet\_id\_i11'h257ID da mensagem no barramento CAN.
packet\_length\_i4'd5"HELLO" tem 5 caracteres ➡️ 5 bytes.
tx\_data\_0\_i72Letter H (ASCII 72).
tx\_data\_1\_i69Letter E (ASCII 69).
tx\_data\_2\_i76Letter L (ASCII 76).
tx\_data\_3\_i76Letter L (ASCII 76).
tx\_data\_4\_i79Letter O (ASCII 79).
![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXftOs1my6Q0B1nUgBknEuBNOjUfXUMfWj8b8r75UFirBA6c8hlEuM7AONS7YuBRkanAF7gfnacPDIvwxf3tJFKENP03XdF4rJzBC3C6mcAsDQ74dmH5MyYGmsn0l5qc0rofD5_Slk9LIiY29q14odw?key=tBiA3od2N48C8_l4qPd-3A8p) ##### **2.3 System Outputs** ***a) Outputs of the can\_controller\_std Block*** The outputs of the can\_controller\_std block are responsible for: - Transmitting CAN frames on the bus. - Indicating the status of operations (message transmission and reception). - Providing received data to other system modules, such as the UART debug interface. These outputs enable both physical communication via CAN and system monitoring through UART and LEDs.
OutputDestinationFunction
tx\_oIO71Transmits the CAN frame on the bus.
transmit\_irq\_oLED0Indicates that the transmission has started.
transmit\_ack\_irq\_oLED1Confirms that the transmission was acknowledged (ACK).
receive\_irq\_ouart\_can\_std\_printerSignals that a CAN frame has been received.
***b) Outputs of the uart\_can\_std\_printer Block*** In addition to the direct outputs of the can\_controller\_std, there are components that process this information and provide user feedback through LEDs and UART.
OutputDestinationFunction
uartTxPinuartTxSends the received message via UART (ASCII).
txDoneLED5Indicates that the UART transmission is complete.
![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeblMB9WYc9mVsUAOfRCFuzYS_T1YlE6qt1fhhWShGxEilUHkyjhXQ9sth8HPL0Gxi9gYSQRXEOLXMlspBB78X0CyAPAAX_k41L7nUYpBBu7updgMdgK4_bk8C9DVw9whAzYP7qKweiie1IePng2B0?key=tBiA3od2N48C8_l4qPd-3A8p) And at the end, your project should be something like this: ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfgvkjluxUElCg8GdLGjilam5Gtoh806HxZIW6uwYRUFDHdyl1kcXnciGWd8Sp4tKvEUYp4SvDw7H4jiLy7_82p2qamWSHusYlfS3lNsuKLh4WfWdHsoPxBKp51xBZZ-ktCccl2SZPSU-FiGQcDSAE?key=tBiA3od2N48C8_l4qPd-3A8p)