Skip to contentSkip to conversation

f81601 rtcan driver issue

DISCUSSION [email protected] 2 participants 2 messages Sep 27, 2024

lore
Share & tools
lore
#0 lore raw

Hi xenomai:

    I use the xenomai 3.2.3 with the intel J6412 platform,the kernel version is 5.15.51。
    when i ported the f81601 can driver int RTDM framework。 I use blow command test the can.
    #rtcanconfig rtcan0 --baudrate=500000 start
    #rtcansend rtcan0 --verbose --timeout=10 --identifier=0x123 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8
    then i send the oscilloscope, No waveform. and the interrupt status register Error Warning Interrupt, Error Passive Interrupt Enable and Bus Error Interrupt Enable.
    then I change the rtcan_sja1000.c chip_init code, this issue is solved. Blow is the changed code.

    diff --git a/kernel/drivers/can/sja1000/rtcan_sja1000.c b/kernel/drivers/can/sja1000/rtcan_sja1000.c
    index 073a34325..90f6b3066 100644
    --- a/kernel/drivers/can/sja1000/rtcan_sja1000.c
    +++ b/kernel/drivers/can/sja1000/rtcan_sja1000.c
    @@ -737,7 +737,7 @@ static void sja1000_chip_config(struct rtcan_device *dev)
     struct rtcan_sja1000 *chip = (struct rtcan_sja1000* )dev->priv;

     chip->write_reg(dev, SJA_CDR, chip->cdr);

- chip->write_reg(dev, SJA_OCR, chip->ocr);
+ chip->write_reg(dev, SJA_OCR, chip->ocr | SJA_OCR_MODE_NORMAL);

     chip->write_reg(dev, SJA_AMR0, 0xFF);
     chip->write_reg(dev, SJA_AMR1, 0xFF);

--------------

[email protected]

#1 lore raw
Quoted 16 lines · On 27.09.24 12:56, [email protected] wrote:

Hi xenomai:

    I use the xenomai 3.2.3 with the intel J6412 platform,the kernel version is 5.15.51。
    when i ported the f81601 can driver int RTDM framework。 I use blow command test the can.
    #rtcanconfig rtcan0 --baudrate=500000 start
    #rtcansend rtcan0 --verbose --timeout=10 --identifier=0x123 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8
    then i send the oscilloscope, No waveform. and the interrupt status register Error Warning Interrupt, Error Passive Interrupt Enable and Bus Error Interrupt Enable.
    then I change the rtcan_sja1000.c chip_init code, this issue is solved. Blow is the changed code.

    diff --git a/kernel/drivers/can/sja1000/rtcan_sja1000.c b/kernel/drivers/can/sja1000/rtcan_sja1000.c
    index 073a34325..90f6b3066 100644
    --- a/kernel/drivers/can/sja1000/rtcan_sja1000.c
    +++ b/kernel/drivers/can/sja1000/rtcan_sja1000.c
    @@ -737,7 +737,7 @@ static void sja1000_chip_config(struct rtcan_device *dev)
     struct rtcan_sja1000 *chip = (struct rtcan_sja1000* )dev->priv;

     chip->write_reg(dev, SJA_CDR, chip->cdr);
Quoted 3 lines

- chip->write_reg(dev, SJA_OCR, chip->ocr);
+ chip->write_reg(dev, SJA_OCR, chip->ocr | SJA_OCR_MODE_NORMAL);

You just need to initialize chip->ocr properly in your ported driver. This is the wrong place.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center