Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    T507使用mcp2515转CAN问题

    其它全志芯片讨论区
    2
    19
    320
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      Gawaine LV 3 last edited by

      T507使用mcp2515转CAN,出现初始化不正常的问题,打印信息如下:
      ec368524-f34c-430b-a030-7ee4e23ceeeb-image.png
      飞凌嵌入式的那个模板我也参考了,该配置的都配置了,还是报[6.800547] mcp251x spi1.0: Cannot initialize MCP2515. Wrong wiring?
      [ 6.807717] mcp251x spi1.0: Probe failed, err=19
      这两个错误,
      单独使用spidev_test测量SPI也有数据,但是在接mcp2515,开机上电测量有两个拉低的片选信号,没有时钟信号,时钟信号开机之后直接拉低了。
      没有头绪了,还请各位大神给指点指点,谢谢!!!

      W 1 Reply Last reply Reply Quote Share 0
      • W
        whycan晕哥 LV 9 @Gawaine last edited by

        @gawaine

        https://mariadb.com/kb/en/operating-system-error-codes/

        19 ENODEV No such device

        看下 dts 怎么写的.

        G 2 Replies Last reply Reply Quote Share 0
        • G
          Gawaine LV 3 @whycan last edited by

          @whycan 您好大神,附件里是dts文件,请查收,谢谢!!!
          另外,晶振配置写在了sun50iw9p1-clk里,如下:
          41f8bd5f-4649-4bfd-8832-fc125803d4d5-image.png
          Pin配置如下:
          05e50be0-66f4-43d1-9652-1d15f86b2f9f-image.png

          1 Reply Last reply Reply Quote Share 0
          • G
            Gawaine LV 3 @whycan last edited by

            @whycan 您好大神,这是dts文件board.dts

            W 1 Reply Last reply Reply Quote Share 0
            • W
              whycan晕哥 LV 9 @Gawaine last edited by

              @gawaine

              3e549d76-d38b-4645-a735-24d03aaf7e46-image.png

              这里确认没问题吗?

              G 1 Reply Last reply Reply Quote Share 0
              • G
                Gawaine LV 3 @whycan last edited by

                @whycan mcp2515_int0这个文件也写在了board.dts里,如下所示:6c851bf1-1108-481f-867a-d2f962530773-image.png
                这里配置的中断Pin脚是PG18,如果有什么问题还请大神给指出来,谢谢!!!

                W 1 Reply Last reply Reply Quote Share 0
                • W
                  whycan晕哥 LV 9 @Gawaine last edited by

                  @gawaine

                  			spi_board1 {
                  				device_type = "spi_board1";
                  				compatible = "rohm,dh2228fv";
                  				spi-max-frequency = <0x5f5e100>;
                  				reg = <0x0>;
                  				spi-rx-bus-width = <0x1>;
                  				spi-tx-bus-width = <0x1>;
                                                  status = "okay";
                  			};
                  

                  这个能检测到吗?

                  G 1 Reply Last reply Reply Quote Share 0
                  • G
                    Gawaine LV 3 @whycan last edited by

                    @whycan 可以的,使用spidev_test -D /dev/spidev1.0测试,有数据出来,如下所示:
                    c8822b14-214e-4b01-805d-817426f75973-image.png

                    W 1 Reply Last reply Reply Quote Share 0
                    • W
                      whycan晕哥 LV 9 @Gawaine last edited by

                      @gawaine

                      mcp2515 和 dh2228fv 的 cs# 引脚是同一个吗?

                      G 2 Replies Last reply Reply Quote Share 0
                      • G
                        Gawaine LV 3 @whycan last edited by

                        @whycan 是,都是在Pinctrl里配置的:
                        5e738883-3ef7-4199-b812-3d6d552c0a3a-image.png
                        这里测试的时候MI和MO短起来的,我使用示波器抓信号的时候,只抓到了时钟和数据信号,没有抓到片选信号。。。

                        1 Reply Last reply Reply Quote Share 0
                        • G
                          Gawaine LV 3 @whycan last edited by

                          @whycan 另外,大神,mcp251x.c的代码应该是跑到如下这个位置报的错:
                          70727e3d-a494-4fd7-858d-3a29aea16ed7-image.png
                          然后根据ret = mcp251x_hw_probe(spi);,通过打印信息定位到了如下位置:
                          eb6cba32-ce90-4bf6-8ae3-a1b8da1153ad-image.png
                          又根据ret = mcp251x_hw_reset(spi);通过打印信息定位到了如下位置:
                          3ab851b6-1638-4455-afee-773ee2a0c0ef-image.png

                          W 1 Reply Last reply Reply Quote Share 0
                          • W
                            whycan晕哥 LV 9 @Gawaine last edited by

                            @gawaine

                                                            pinctrl-names = "default";
                                                            pinctrl-0 = <&mcp2515_int0>;
                            

                            这两行删了试一试

                            有没有逻辑分析仪?

                            G 2 Replies Last reply Reply Quote Share 0
                            • G
                              Gawaine LV 3 @whycan last edited by

                              @whycan 我试了一下,还是报那个错误;我这边现在没有逻辑分析仪,只有示波器......

                              1 Reply Last reply Reply Quote Share 0
                              • G
                                Gawaine LV 3 @whycan last edited by

                                @whycan 大神,设备树里要不要增加电源的设置:
                                a684ea21-720d-427d-b5ad-1a1d435dc122-image.png
                                我用的电源是3.3V,是不是跟电源也有关系呢?

                                1 Reply Last reply Reply Quote Share 0
                                • W
                                  whycan晕哥 LV 9 last edited by whycan

                                  @gawaine

                                  90172463-e542-4388-8aac-1d3d018c6ea7-image.png

                                  bb69e99d-3086-48b2-8c88-ef4c880df6b4-image.png

                                  建议看下电源是不是应该3V3,有没有正常复位,最好去淘宝下单买个萝莉分析仪,过几天有钱都买不到了.

                                  G 2 Replies Last reply Reply Quote Share 0
                                  • G
                                    Gawaine LV 3 @whycan last edited by

                                    This post is deleted!
                                    1 Reply Last reply Reply Quote Share 0
                                    • G
                                      Gawaine LV 3 @whycan last edited by

                                      @whycan 你好大神,手册上说有硬件复位和SPI复位,这两种复位方式效果一样,上电后要采用其中一种方式复位器件,以确保逻辑和寄存器处于缺省状态,现在硬件上有一个RC外部复位电路如下
                                      832d8063-3f94-45fd-829f-b920f3f7a40e-image.png
                                      使用的是一个RC复位电路,我测试了一下,外部复位pin脚在下电后始终有一个大约0.8V的电平,即使拆掉C122这颗电容,这个0.8V的电平还是存在的,测一下mcp2515的VDD引脚,也有一个0.8V电平,又测了一下PMIC端,DCDC1的输出也有一个0.8V电源,但是DCDC2上就没有,这说明是从DCDC1的其他负载上耦合过来的。
                                      但是现在SPI没有和mcp2515建立起正常的通讯,就必须依靠外部复位,手册上说Reset的低电平输入最大值VIL=0.15VDD=0.15*3.3V=0.495V,如果使用SPI复位,这个存在的0.8V电平对于器件是不是也是不正常的,或者说影响了器件的复位和正常工作呢?

                                      W 1 Reply Last reply Reply Quote Share 0
                                      • W
                                        whycan晕哥 LV 9 @Gawaine last edited by

                                        @gawaine

                                        先解决 0.8V问题,外部不正常如何判断当前电路状态.

                                        淘宝上面有MCP2515模块,要不要买个试一试?

                                        G 1 Reply Last reply Reply Quote Share 0
                                        • G
                                          Gawaine LV 3 @whycan last edited by

                                          @whycan 好的,我稍后买一个试试,谢谢了大神!!!

                                          1 Reply Last reply Reply Quote Share 0
                                          • 1 / 1
                                          • First post
                                            Last post

                                          Copyright © 2022 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                                          行为准则 | 用户协议 | 隐私权政策