This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: How to use DCAN

Part Number: AM5728

Hi all,

I encountered some problems when I used DCAN.

I was able to set the bitrate, but when I tried to turn on the device, the following error:

root@am57xx-evm:~# canconfig can0 bitrate 50000 ctrlmode triple-sampling on
can0 bitrate: 50000, sample-point: 0.875
can0 ctrlmode: loopback[OFF], listen-only[OFF], tripple-sampling[ON],one-shot[OF
F], berr-reporting[OFF]
root@am57xx-evm:~# canconfig can0 start
[ 1149.882464] net can0: c_can_hw_raminit_wait_syscon: time out
[ 1149.888401] c_can_platform 4ae3c000.can can0: setting BTR=1c18 BRPE=0000
can0 state: ERROR-ACTIVE

This is dmesg and the driver loads the print:

root@am57xx-evm:~# dmesg | grep can
[    6.415792] ahci 4a140000.sata: SSS flag set, parallel bus scan disabled
[    6.658759] pinctrl-single 4a003400.pinmux: could not add functions for dcan1
_pins_default 14288x
[    6.692822] c_can_platform 4ae3c000.can: c_can_platform device registered (re
gs=fce3c000, irq=356)
[ 1149.882464] net can0: c_can_hw_raminit_wait_syscon: time out
[ 1149.888401] c_can_platform 4ae3c000.can can0: setting BTR=1c18 BRPE=0000


root@am57xx-evm:~# lsmod | grep can
c_can_platform          6604  0
c_can                   9462  1 c_can_platform
can_dev                12292  1 c_can

I can find the CAN0 device after executing the 'canconfig can0 start' command

root@am57xx-evm:~# ifconfig                                                     
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
-00                                                                             
          UP RUNNING NOARP  MTU:16  Metric:1                                    
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0                    
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                  
          collisions:0 txqueuelen:10                                            
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)                                
          Interrupt:100                                     

This is some information when I execute the 'cansequence' command

root@am57xx-evm:~# cansequence can0                                             
interface = can0, family = 29, type = 3, proto = 1                              
[  185.975735] can: controller area network core (rev 20120528 abi 9)           
[  185.982345] NET: Registered protocol family 29                               
[  185.991247] can: raw protocol (rev 20120528)                                 
^C                                                                              
root@am57xx-evm:~# cat /proc/net/can/stats                                      
                                                                                
  1286933 transmitted frames (TXF)                                              
        3 received frames (RXF)                                                 
        0 matched frames (RXMF)                                                 
                                                                                
        0 % total match ratio (RXMR)                                            
        0 frames/s total tx rate (TXR)                                          
        0 frames/s total rx rate (RXR)                                          
                                                                                
        0 % current match ratio (CRXMR)                                         
        0 frames/s current tx rate (CTXR)                                       
        0 frames/s current rx rate (CRXR)                                       
                                                                                
        0 % max match ratio (MRXMR)                                             
   481206 frames/s max tx rate (MTXR)                                           
        3 frames/s max rx rate (MRXR)                                           
                                                                                
        0 current receive list entries (CRCV)                                   
        0 maximum receive list entries (MRCV)                                   
                                                                                
root@am57xx-evm:~# lsmod | grep can                                             
can_raw                 6589  1                                                 
can                    29605  1 can_raw                                         
c_can_platform          6604  0                                                 
c_can                   9462  1 c_can_platform                                  
can_dev                12292  1 c_can 

                                          
root@am57xx-evm:~# dmesg | grep can                                             
[    5.981282] ahci 4a140000.sata: SSS flag set, parallel bus scan disabled     
[    6.187731] pinctrl-single 4a003400.pinmux: could not add functions for dcan1
_pins_default 14288x                                                            
[    6.203728] c_can_platform 4ae3c000.can: c_can_platform device registered (re
gs=fce3c000, irq=356)                                                           
[  129.752423] net can0: c_can_hw_raminit_wait_syscon: time out                 
[  129.758349] c_can_platform 4ae3c000.can can0: setting BTR=1c18 BRPE=0000     
[  185.975735] can: controller area network core (rev 20120528 abi 9)           
[  185.991247] can: raw protocol (rev 20120528)   

I tested using two boards to connect:

I've ever sent a post:

https://e2e.ti.com/support/arm/sitara_arm/f/791/p/562088/2060062#pi316653=1

According to your proposal to change the hardware can be used after.

Now my hardware and software and the same as before, but prompted me to pinmux problems,this is my pinmux.

&dra7_pmx_core {

dcan1_pins_default: dcan1_pins_default {
    pinctrl-single,pins = <
        0x37d0   (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* dcan1_tx */
        0x37d4   (PIN_INPUT_PULLUP | MUX_MODE0) /* dcan1_rx */
        >;
    };  
};

&dcan1 {
      status = "okay";
      pinctrl-names = "default";
      pinctrl-0 = <&dcan1_pins_default>;
};

Hope you can help me solve this problem.

Thanks