Skip to content

Commit c60f134

Browse files
authored
Merge pull request #3348 from TomoYamanaka/master
Fix frequency function of CAN driver.
2 parents ad8a77d + cea2772 commit c60f134

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

targets/TARGET_RENESAS/TARGET_RZ_A1H/can_api.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ void can_free(can_t *obj) {
581581
}
582582

583583
int can_frequency(can_t *obj, int f) {
584+
__IO uint32_t *dmy_cfcc;
584585
int retval = 0;
585586

586587
if (f <= 1000000) {
@@ -590,6 +591,12 @@ int can_frequency(can_t *obj, int f) {
590591
can_set_frequency(obj, f);
591592
/* set Channel Communication mode */
592593
can_set_channel_mode(obj->ch, CH_COMM);
594+
/* restore CFE bit since it is cleared */
595+
/* Use send/receive FIFO buffer */
596+
dmy_cfcc = CFCC_TBL[obj->ch][CAN_SEND];
597+
*dmy_cfcc |= 0x01;
598+
dmy_cfcc = CFCC_TBL[obj->ch][CAN_RECV];
599+
*dmy_cfcc |= 0x01;
593600
retval = 1;
594601
}
595602

targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/can_api.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ void can_free(can_t *obj) {
598598
}
599599

600600
int can_frequency(can_t *obj, int f) {
601+
__IO uint32_t *dmy_cfcc;
601602
int retval = 0;
602603

603604
if (f <= 1000000) {
@@ -607,6 +608,12 @@ int can_frequency(can_t *obj, int f) {
607608
can_set_frequency(obj, f);
608609
/* set Channel Communication mode */
609610
can_set_channel_mode(obj->ch, CH_COMM);
611+
/* restore CFE bit since it is cleared */
612+
/* Use send/receive FIFO buffer */
613+
dmy_cfcc = CFCC_TBL[obj->ch][CAN_SEND];
614+
*dmy_cfcc |= 0x01;
615+
dmy_cfcc = CFCC_TBL[obj->ch][CAN_RECV];
616+
*dmy_cfcc |= 0x01;
610617
retval = 1;
611618
}
612619

0 commit comments

Comments
 (0)