Skip to main content

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.

 

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.



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.


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).



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.


And at the end, your project should be something like this: