Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CTU CAN FD IP Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canbus
CTU CAN FD IP Core
Commits
acf9de82
Commit
acf9de82
authored
Apr 30, 2020
by
Ille, Ondrej, Ing.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Implement protocol exception in Protocol control FSM.
parent
4243eab9
Pipeline
#19558
failed with stages
in 19 minutes and 57 seconds
Changes
5
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
17 deletions
+112
-17
src/can_core/protocol_control.vhd
src/can_core/protocol_control.vhd
+4
-0
src/can_core/protocol_control_fsm.vhd
src/can_core/protocol_control_fsm.vhd
+98
-14
src/lib/can_components.vhd
src/lib/can_components.vhd
+3
-0
src/lib/drv_stat_pkg.vhd
src/lib/drv_stat_pkg.vhd
+2
-0
src/memory_registers/memory_registers.vhd
src/memory_registers/memory_registers.vhd
+5
-3
No files found.
src/can_core/protocol_control.vhd
View file @
acf9de82
...
...
@@ -456,6 +456,8 @@ architecture rtl of protocol_control is
-- Secondary sampling point configuration
signal
drv_ssp_delay_select
:
std_logic_vector
(
1
downto
0
);
-- Protocol exception
signal
drv_pex
:
std_logic
;
-----------------------------------------------------------------------------
-- Internal signals
...
...
@@ -626,6 +628,7 @@ begin
drv_bus_off_reset
<=
drv_bus
(
DRV_ERR_CTR_CLR
);
drv_ssp_delay_select
<=
drv_bus
(
DRV_SSP_DELAY_SELECT_HIGH
downto
DRV_SSP_DELAY_SELECT_LOW
);
drv_pex
<=
drv_bus
(
DRV_PEX_INDEX
);
---------------------------------------------------------------------------
-- TX Data word endian swapper
...
...
@@ -668,6 +671,7 @@ begin
drv_int_loopback_ena
=>
drv_int_loopback_ena
,
-- IN
drv_can_fd_ena
=>
drv_can_fd_ena
,
-- IN
drv_ssp_delay_select
=>
drv_ssp_delay_select
,
-- IN
drv_pex
=>
drv_pex
,
-- IN
is_control
=>
is_control
,
-- OUT
is_data
=>
is_data
,
-- OUT
is_stuff_count
=>
is_stuff_count
,
-- OUT
...
...
src/can_core/protocol_control_fsm.vhd
View file @
acf9de82
...
...
@@ -138,6 +138,9 @@ entity protocol_control_fsm is
-- Secondary sampling point delay select
drv_ssp_delay_select
:
in
std_logic_vector
(
1
downto
0
);
-- Protocol exception handling
drv_pex
:
in
std_logic
;
-- Control field is being transmitted
is_control
:
out
std_logic
;
...
...
@@ -746,6 +749,10 @@ architecture rtl of protocol_control_fsm is
-- Clear bus-off reset flag
signal
clr_bus_off_rst_flg
:
std_logic
;
-- Protocol exception signals
signal
pex_on_fdf_enable
:
std_logic
;
signal
pex_on_res_enable
:
std_logic
;
begin
tx_frame_ready
<=
'1'
when
(
tran_frame_valid
=
'1'
and
drv_bus_mon_ena
=
'0'
)
...
...
@@ -821,6 +828,16 @@ begin
else
'0'
;
pex_on_fdf_enable
<=
'1'
when
(
drv_ena
=
FDE_DISABLE
and
drv_pex
=
PROTOCOL_EXCEPTION_ENABLED
)
else
'0'
;
pex_on_res_enable
<=
'1'
when
(
drv_ena
=
FDE_ENABLE
and
drv_pex
=
PROTOCOL_EXCEPTION_ENABLED
)
else
'0'
;
---------------------------------------------------------------------------
-- CRC sequence selection
---------------------------------------------------------------------------
...
...
@@ -1000,9 +1017,13 @@ begin
when
s_pc_edl_r1
=>
if
(
rx_data_nbs
=
DOMINANT
)
then
next_state
<=
s_pc_r0_ext
;
else
if
(
pex_on_fdf_enable
=
'1'
)
then
next_state
<=
s_pc_integrating
;
else
next_state
<=
s_pc_r0_fd
;
end
if
;
end
if
;
-------------------------------------------------------------------
-- r0 bit after EDL/r1 bit in Extended CAN Frames.
...
...
@@ -1011,10 +1032,14 @@ begin
next_state
<=
s_pc_dlc
;
-------------------------------------------------------------------
-- r0 bit in CAN FD Frames (both Base and Extended identifier)
-- r0
(res)
bit in CAN FD Frames (both Base and Extended identifier)
-------------------------------------------------------------------
when
s_pc_r0_fd
=>
if
(
rx_data_nbs
=
RECESSIVE
and
pex_on_res_enable
=
'1'
)
then
next_state
<=
s_pc_integrating
;
else
next_state
<=
s_pc_brs
;
end
if
;
-------------------------------------------------------------------
-- EDL/r0 bit in CAN 2.0 and CAN FD Frames with BASE identifier
...
...
@@ -1023,9 +1048,15 @@ begin
when
s_pc_edl_r0
=>
if
(
rx_data_nbs
=
DOMINANT
)
then
next_state
<=
s_pc_dlc
;
else
-- Protocol exception on recessive FDF/EDL in "Classical CAN"
-- configuration
if
(
pex_on_fdf_enable
=
'1'
)
then
next_state
<=
s_pc_integrating
;
else
next_state
<=
s_pc_r0_fd
;
end
if
;
end
if
;
-------------------------------------------------------------------
-- BRS (Bit rate shift) Bit
...
...
@@ -1746,11 +1777,29 @@ begin
end
if
;
end
if
;
if
((
drv_can_fd_ena
=
FDE_DISABLE
)
or
(
tran_frame_type
=
NORMAL_CAN
and
is_transmitter
=
'1'
))
and
(
rx_data_nbs
=
RECESSIVE
)
-- Sample recessive but CAN FD is disabled -> Form error or
-- protocol exception!
if
(
rx_data_nbs
=
RECESSIVE
and
drv_can_fd_ena
=
FDE_DISABLE
)
then
if
(
drv_pex
=
PROTOCOL_EXCEPTION_DISABLED
)
then
form_err_i
<=
'1'
;
-----------------------------------------------------------
-- Here we detect protocol exception. Although unit should
-- not be transmitter at this moment (see datasheet), it
-- is possible user is stupid! Unlock TXT Buffer so that
-- it does not end up in deadlock!
-----------------------------------------------------------
elsif
(
is_transmitter
=
'1'
)
then
txtb_hw_cmd_d
.
unlock
<=
'1'
;
stuff_enable_clear
<=
'1'
;
if
(
tx_failed
=
'1'
)
then
txtb_hw_cmd_d
.
failed
<=
'1'
;
else
txtb_hw_cmd_d
.
arbl
<=
'1'
;
end
if
;
end
if
;
end
if
;
-------------------------------------------------------------------
...
...
@@ -1793,7 +1842,24 @@ begin
-- protocol (CAN XL in future). Now we don't have protocol
-- exception, so we throw error here!
if
(
rx_data_nbs
=
RECESSIVE
)
then
if
(
drv_pex
=
PROTOCOL_EXCEPTION_DISABLED
)
then
form_err_i
<=
'1'
;
-----------------------------------------------------------
-- Here we detect protocol exception. Although unit should
-- not be transmitter at this moment (see datasheet), it
-- is possible user is stupid! Unlock TXT Buffer so that
-- it does not end up in deadlock!
-----------------------------------------------------------
elsif
(
is_transmitter
=
'1'
)
then
txtb_hw_cmd_d
.
unlock
<=
'1'
;
stuff_enable_clear
<=
'1'
;
if
(
tx_failed
=
'1'
)
then
txtb_hw_cmd_d
.
failed
<=
'1'
;
else
txtb_hw_cmd_d
.
arbl
<=
'1'
;
end
if
;
end
if
;
end
if
;
-------------------------------------------------------------------
...
...
@@ -1821,11 +1887,29 @@ begin
ssp_reset_i
<=
'1'
;
end
if
;
if
((
drv_can_fd_ena
=
FDE_DISABLE
)
or
(
tran_frame_type
=
NORMAL_CAN
and
is_transmitter
=
'1'
))
and
(
rx_data_nbs
=
RECESSIVE
)
-- Sample recessive but CAN FD is disabled -> Form error or
-- protocol exception!
if
(
rx_data_nbs
=
RECESSIVE
and
drv_can_fd_ena
=
FDE_DISABLE
)
then
if
(
drv_pex
=
PROTOCOL_EXCEPTION_DISABLED
)
then
form_err_i
<=
'1'
;
-----------------------------------------------------------
-- Here we detect protocol exception. Although unit should
-- not be transmitter at this moment (see datasheet), it
-- is possible user is stupid! Unlock TXT Buffer so that
-- it does not end up in deadlock!
-----------------------------------------------------------
elsif
(
is_transmitter
=
'1'
)
then
txtb_hw_cmd_d
.
unlock
<=
'1'
;
stuff_enable_clear
<=
'1'
;
if
(
tx_failed
=
'1'
)
then
txtb_hw_cmd_d
.
failed
<=
'1'
;
else
txtb_hw_cmd_d
.
arbl
<=
'1'
;
end
if
;
end
if
;
end
if
;
-------------------------------------------------------------------
...
...
src/lib/can_components.vhd
View file @
acf9de82
...
...
@@ -1520,6 +1520,9 @@ package can_components is
-- Secondary sampling point delay select
drv_ssp_delay_select
:
in
std_logic_vector
(
1
downto
0
);
-- Protocol exception handling
drv_pex
:
in
std_logic
;
-- Arbitration field is being transmitted
is_arbitration
:
out
std_logic
;
...
...
src/lib/drv_stat_pkg.vhd
View file @
acf9de82
...
...
@@ -218,6 +218,8 @@ package drv_stat_pkg is
constant
DRV_ENA_INDEX
:
natural
:
=
509
;
constant
DRV_FD_TYPE_INDEX
:
natural
:
=
510
;
constant
DRV_PEX_INDEX
:
natural
:
=
511
;
----------------------------------------------------------------------------
-- RX, TX and TXT Buffer frame format signal indexes
----------------------------------------------------------------------------
...
...
src/memory_registers/memory_registers.vhd
View file @
acf9de82
...
...
@@ -592,6 +592,9 @@ begin
drv_bus
(
DRV_INT_LOOBACK_ENA_INDEX
)
<=
align_wrd_to_reg
(
control_registers_out
.
settings
,
ILBP_IND
);
-- PEX - Protocol exception mode
drv_bus
(
DRV_PEX_INDEX
)
<=
align_wrd_to_reg
(
control_registers_out
.
settings
,
PEX_IND
);
---------------------------------------------------------------------------
-- INT_STAT - Clearing interrupt vector by write
...
...
@@ -1424,14 +1427,13 @@ begin
drv_bus
(
360
downto
358
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
362
downto
361
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
365
downto
363
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
370
downto
368
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
371
)
<=
'0'
;
drv_bus
(
371
downto
368
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
399
downto
383
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
459
downto
445
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
464
downto
462
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
609
downto
601
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
579
downto
570
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
519
downto
51
1
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
519
downto
51
2
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
506
downto
475
)
<=
(
OTHERS
=>
'0'
);
drv_bus
(
444
downto
430
)
<=
(
OTHERS
=>
'0'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment