Forum Rule: Always post complete source code & details to reproduce any issue!
Page 27 of 27 FirstFirst ... 17 25 26 27
Results 651 to 665 of 665

Thread: FlexCAN_T4 - FlexCAN for Teensy 4

  1. #651
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    thats a different id and doesnt correlate to your sends, is the device sending you that? what is the device?

  2. #652
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    Quote Originally Posted by tonton81 View Post
    thats a different id and doesnt correlate to your sends, is the device sending you that? what is the device?
    Power Supply Huawei R4850
    Click image for larger version. 

Name:	2021-04-22_074425.png 
Views:	2 
Size:	226.6 KB 
ID:	24518

  3. #653
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    well you need the manual for it then, i tried googling and came up with this:
    https://github.com/craigpeacock/Huaw.../Protocol.xlsx

    the IDs dont match what your sending or receiving, but since your receiving something it means your sending the wrong/right data to the wrong canid thats why it's not responding

  4. #654
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    Quote Originally Posted by tonton81 View Post
    well you need the manual for it then, i tried googling and came up with this:
    https://github.com/craigpeacock/Huaw.../Protocol.xlsx

    the IDs dont match what your sending or receiving, but since your receiving something it means your sending the wrong/right data to the wrong canid thats why it's not responding
    yes, this is the document I use,
    but it turns out that nothing works, I am sure that I am doing something wrong,
    but I can't understand what am I doing wrong? if the error is in the team, how should it be correct?

    maybe I'm not forming the team correctly ?

  5. #655
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    wow .... found a bug !!!

    I had it like that:
    msg.buf[0] = 0x01;
    msg.buf[1] = 0x01;

    did so:
    msg.buf[0] = 0x01;
    msg.buf[1] = 0x00;

    now the voltage switches very quickly,
    but another problem appeared, this voltage changes for 1 minute,
    then reverts to the previous value!
    now you need to figure out how to remember it ?

    it looks like now I need to send two commands in a row,
    switch and remember, do I understand correctly ?

  6. #656
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    did you read last line of the xlsx?




    The rectifier can operate in two states:
    Off-line is when there is no CAN communication (i.e. standalone operation). This occurs on power-up or if CAN communication has timed-out (Orange LED slowly blinking).
    On-line values are only valid when CAN communication is present (Orange LED not blinking). These values are volatile and reset to default on loss of CAN comms.
    CAN communication time-out is approximately 60 seconds. i.e. if you stop sending valid CAN messages to the rectifier, the rectifier will switch to Off-line/Default values in approximately 60 seconds.






    You basically need to keep transmitting whatever within 60 seconds for it to remain active, if you stop transmitting for 60 seconds thats it. so send every 30 seconds if you want

  7. #657
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    Quote Originally Posted by tonton81 View Post
    did you read last line of the xlsx?
    You basically need to keep transmitting whatever within 60 seconds for it to remain active, if you stop transmitting for 60 seconds thats it. so send every 30 seconds if you want
    yes, now thanks to you, I understood everything
    I am very grateful to you for your help!
    and if, can you tell me how to write the code correctly, for these purposes ?
    I will be your debtor!

  8. #658
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    1 then 0 workes because on the chart, Online in green is for CAN, because you were sending 1 then 1, you actually disabled canbus so the normal voltage would be output, Offline meant no canbus traffic allowed

  9. #659
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    try using the FIFO with interrupts example so you can see what the responses are, then try to send the message with byte0 as 1 and byte 1 as 0 and repeat send in loop with delay(5), see what it responds?

    everytime its sending every 5 seconds, the powersupply 60 second counter resets, so it shouldnt timeout since your hitting it every 5 seconds, thats more of a powersupply safety, if no data is communicating it'll most likely shut down and wait

  10. #660
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    Quote Originally Posted by tonton81 View Post
    try using the FIFO with interrupts example so you can see what the responses are, then try to send the message with byte0 as 1 and byte 1 as 0 and repeat send in loop with delay(5), see what it responds?

    everytime its sending every 5 seconds, the powersupply 60 second counter resets, so it shouldnt timeout since your hitting it every 5 seconds, thats more of a powersupply safety, if no data is communicating it'll most likely shut down and wait
    Thank you for your reply!
    but for me it is difficult, I cannot do that, I lack knowledge
    I plan to send two commands sequentially,
    first online, then offline, probably this is not correct, but otherwise I have no idea how to do it

  11. #661
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    this?

    Code:
    #include <IFCT.h>
    
    CAN_message_t msg;
    
    void setup() {
      Can0.setBaudRate(125000);
      Can0.enableFIFO();
    
      msg.ext = 1;
      msg.id = 0x108180fe;
      msg.len = 8;
      msg.buf[0] = 0x01;
      msg.buf[1] = 0x00;
      msg.buf[2] = 0x00;
      msg.buf[3] = 0x00;
      msg.buf[4] = 0x00;
      msg.buf[5] = 0x00;
      msg.buf[6] = 0xd6; //Voltage
      msg.buf[7] = 0x00;
    
      Can0.write(msg);
    }
    
    void loop() {
    
    
    Can0.write(msg);
    delay(5000);
    
    }

  12. #662
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    Quote Originally Posted by tonton81 View Post
    this?

    Code:
    #include <IFCT.h>
    
    CAN_message_t msg;
    
    void setup() {
      Can0.setBaudRate(125000);
      Can0.enableFIFO();
    
      msg.ext = 1;
      msg.id = 0x108180fe;
      msg.len = 8;
      msg.buf[0] = 0x01;
      msg.buf[1] = 0x00;
      msg.buf[2] = 0x00;
      msg.buf[3] = 0x00;
      msg.buf[4] = 0x00;
      msg.buf[5] = 0x00;
      msg.buf[6] = 0xd6; //Voltage
      msg.buf[7] = 0x00;
    
      Can0.write(msg);
    }
    
    void loop() {
    
    
    Can0.write(msg);
    delay(5000);
    
    }
    Yes fine! Thank you!

  13. #663
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    tonton81, maybe you will have a free minute,
    can you show me how to receive data from a block please?
    with not a lot of sample code?

  14. #664
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    you need to use the "FIFO with interrupts" example and use the same loop() with delay you added earlier, then you'll see the responses every 5 seconds you transmit, according to the xlsx, you'll get a frame reply ACK after the send

  15. #665
    Junior Member
    Join Date
    Apr 2021
    Posts
    19
    Quote Originally Posted by tonton81 View Post
    you need to use the "FIFO with interrupts" example and use the same loop() with delay you added earlier, then you'll see the responses every 5 seconds you transmit, according to the xlsx, you'll get a frame reply ACK after the send
    ok, I understand you, I will try to figure it out.
    thank you again for your time!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •