1 Reply Latest reply on Oct 20, 2020 3:28 AM by EktaN_26

    Configure programmable mirco USB as CAN BUS

    RoHo_4709346

      Hi community,

       

      I want to configure the programmable micro USB port of my board (CY8CKIT-059 PSoC 5LP) as a CAN bus. Plan is to build up a modular CAN bus wherein I can quickly plugin new devices. For the wiring plan is to use the outer 2 USB wires (GND VDD) as power supply and the inner pins (micro USB's DM and DP) for CAN bus TX RX.

       

      Therefore, I have to be able to define psoc's mircoUSB's DM and DP ports 15[7] 15[6]as In/Output for the CAN TX RX. However, DP and DM pots can only be defined as "Strong Drive" and "Open Drain, Drives Low". I could manage to work pins as a programmable digital output, but sadly I can't make them  to work as an Input.

       

       

      Therefore, I want to ask for help on how define mircoUSB's DM and DP as readable Inputs and if not possible I want to know why.

      Since the example code for programming micro USB as USBFS UART https://www.cypress.com/documentation/code-examples/ce95396-usb-uart-psoc-35lp works as a serial two-way I-O communication, I'm quite confident that DP and DM should be definable as inputs as well.

       

       

      Thanks for helping!


      Best Regards Robert.

        • 1. Re: Configure programmable mirco USB as CAN BUS
          EktaN_26

          Hello Robert,

           

          In order to USB the USB pins as normal GPIO pins you need to set iomode bit in the USB_USBIO_CR1 register. Please refer to the PSoC 5LP register TRM for more details on the register (see section 1.3.564)

           

          The I/O mode bit in the USBIO_CR1 register puts the USB in either USB mode or Drive mode. When put in Drive mode, the USB signals are disabled and the bits DMI and DPI are used to drive D- and D+, respectively. There are two different drive modes. In CMOS Drive mode, D+ follows the DPI and D- follows the DMI. In the case of Open Drain mode, the pull up resistors play a role. In this state, when the DPI and DMI bits are set to high, D+ and D- are high impedance (Refer section 24.5 of the PSoC 5LP Architecture TRM)

           

          Did you make the above change?

           

          I have created a small project that can be tested on the CY8CKIT-050 in which I have used the USB pin as an input pin. When supplied with a 1 on the input pin the LED stops blinking.

           

          Best Regards

          Ekta