ActiaPete (Customer) asked a question.

P!AM and MKR CAN Shield V2.0

Hi,

I have a P1AM by itself with a MKR CAN Shield V2.0 connected into the MKR Expansion Header. I can run code in the CPU and the MKR CAN shield will initialize and run with the USB cable in place.

 

But, when I connect 24Vdc on the External 24V input, if the MKR CAN has already been initialized with USB power it will continue working. If the P1AM powers up with 24V, the MKR CAN board refuses to initialize. It appears that when powering the 24Vdc there is a conflict between the base and the MKR board.

 

The MKR CAN Board uses pins 7, 8, 9, 10 which it can share with others.

The board also uses +5V, +3.3V, VIN, GND. (but VIN is unpowered since there is nothing connected to that part of the circuit)

There is a 10k2 pull-up on pins 3 and 7.

 

 


  • FACTS_AdamC (AutomationDirect)

    Could you try adding this before you CAN.begin loop?

    1. CAN.setSPIFrequency(1E6);

     

    Selected as Best
  • z28z34man (Customer)

    Do you happen to have while (!Serial) in your code. If so the code will sit and wait there until it connects.

    • ActiaPete (Customer)

      I checked and the symptoms are the same with that line commented.

      I also commented P1.init() since I have no P1000 modules connected.

       

      Thank you

      • z28z34man (Customer)

        I would also try committing out the serial begin and all the serial prints as there is no reason for it if the USB isn't connected.

  • FACTS_AdamC (AutomationDirect)

    I'm looking into what might be causing this. Could you share your code as well?

    • ActiaPete (Customer)

      Yes I can share, I attached my code.

       

      I have to add that when the system is powered with 24Vdc, it never get to the main loop. I have a feeling it gets hung up at the initialize INA219. (Sorry senior moment)

      It gets hung up at the initialize MKR CAN on line 92.

       

      Thank you

      Expand Post
      • FACTS_AdamC (AutomationDirect)

        So the issue occurs whenever 24V is present, or when it is only powered by 24V?

      • FACTS_AdamC (AutomationDirect)

        I would also add your P1.init function. If you don't currently have any modules add "P1.enableBaseController(HIGH);" can still allow the base controller circuitry to initialize which might clean up any edge cases on the SPI bus.

  • ActiaPete (Customer)

    Hi, thank you for the hints.

    I have "P1AM.init();" and "P1.enableBaseController(HIGH);" in my setup loop.

    But when I energize the 24V, the BASE LED flashes a couple of times and the code hangs at the "CAN.begin(500E3)".

    There seems to be an issue between the base and the CAN MKR board.

    Wayne A. from ADC Support suggested "Auto Run", but I am unaware of that function with Arduinos.

     

    If I disconnect the 24Vdc with USB connected then the "CAN.begin(500E3)" works and the rest of the program runs.

    Without USB the I get a shutdown without 24V....

     

    Expand Post
    • FACTS_AdamC (AutomationDirect)

      If you don't have any modules, I would omit the "P1AM.init()" call as the while loop will cause it to stay there indefinitely. I'd also double check your P1AM library is up to date.

       

      I'm unaware of anything called auto run. Is it something related to CAN?

       

      Do you have a multimeter? If so could you double check that the VCC and 5V lines look good when powering with 24V.

       

       

       

      Expand Post
  • ActiaPete (Customer)

    I commented P1AM.init as you suggested, I came to the same conclusion that the function is for modules.

    All my libraries are up to date.

    "Auto Run" is a setting I have seen in PLCs, not in the Arduino world.

    VCC = 3.329V 5V = 5.274V no USB connected and 24Vdc= 24.14V

10 of 15