Forum Rule: Always post complete source code & details to reproduce any issue!
Tab Content
  • tonton81's Avatar
    07-06-2020, 01:41 AM
    better to have it hard wired than in code, pins go hi impedance when the MCU is disconnected, rebooted, or reprogrammed. If a state needs to be enforced when the MCU is unavailable, a resistor is definately required to...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    07-04-2020, 06:30 AM
    i've had teensy 3.5 in my old car for years throughout winter ice and summer heat on canbus running 24/7... it is pretty stable, but you could always run some tests with a furnace and a freezer if needed :P, Obviously...
    2 replies | 147 view(s)
  • tonton81's Avatar
    06-29-2020, 11:03 PM
    oh no, not division :P try >> 1 shift instead of / 2 sorry trying to stay on 'topic' of performance :D
    125 replies | 1669 view(s)
  • tonton81's Avatar
    06-29-2020, 10:34 AM
    const uint8_t adc_pins = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9};
    125 replies | 1669 view(s)
  • tonton81's Avatar
    06-23-2020, 05:21 PM
    if you dont set it, it is unused, just comment it out. Only valid watchdog pins would be set (provided you put in a matching pin), invalid ones or not set wont touch any pins
    11 replies | 581 view(s)
  • tonton81's Avatar
    06-23-2020, 03:51 PM
    the pin is used to drive the output should the watchdog be triggered. this allows the watchdog to reset an external board
    11 replies | 581 view(s)
  • tonton81's Avatar
    06-21-2020, 09:22 PM
    you have a couple options, 1) serialEvents function that fires from yield() whenever serial data appears 2) modify the core's serial buffer, default 64 bytes, but it restores after a reinstall of teensyduino 3)...
    4 replies | 206 view(s)
  • tonton81's Avatar
    06-21-2020, 05:42 AM
    you could always go into the library source and change the teensy's #ifdef to something other than what teensy detects as, so it wouldn't use the onboard controller or occupy resources, and it should still work with the...
    7 replies | 215 view(s)
  • tonton81's Avatar
    06-21-2020, 04:48 AM
    normally pin 10 is commonly used to be CS, but you can use any pin actually.
    7 replies | 215 view(s)
  • tonton81's Avatar
    06-21-2020, 04:25 AM
    hooking it up to teensy's SPI is no different than hooking it to an arduino. But you have to find a working library for that chip, many versions can be found on github. The one built into Teensy has better performance...
    7 replies | 215 view(s)
  • tonton81's Avatar
    06-21-2020, 03:56 AM
    I put the previous flexcan in a branch of the repo "before-TX-interrupts" Update7 has been applied to "master" branch, so no need to patch it anymore.
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-21-2020, 01:09 AM
    Using 4.0 in automotive environment it runs 24/7 on CAN without issues, cabin temperatures here now with summer reached high 70's celcius, no heatsink on T4, enclosed in an atmega2560 enclosure box under the dash
    39 replies | 1547 view(s)
  • tonton81's Avatar
    06-20-2020, 10:59 PM
    the github copy will always be latest, except the patch which is in testing phase on this thread for stability since it introduced transmit interrupt transfers and also able to function directly with interrupts rather...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-20-2020, 01:54 PM
    try to use the github repo with this update7.zip patch: https://forum.pjrc.com/threads/56035-FlexCAN_T4-FlexCAN-for-Teensy-4?p=241861&viewfull=1#post241861
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-20-2020, 05:26 AM
    Your code I am running right now and it IS running perfect AS IS with min 0x100 -> 0x108 max: Interrupted ->MB 99 OVERRUN: 0 LEN: 8 EXT: 0 TS: 24977 ID: 100 Buffer: 1 2 2 2 2 2 2 2 Interrupted ->MB 99 OVERRUN:...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-19-2020, 10:44 PM
    0xFE is less than 0x100, why do you expect it to pass the filter? The filter (hardware) is doing exactly what it supposed to. The reason why your getting some frames above 0x108 (0x10B) is due to nature of masking...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-19-2020, 01:16 PM
    Yes they should work, they're the ones used on skpang triple CAN board for T4
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-18-2020, 06:29 PM
    they can only transmit once and retry if they dont receive ACK. only your code can cause multiple sends, but in hardware, mailbox will send once only even if it retries, it stops when an ACK is present to confirm the...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-18-2020, 02:01 PM
    looks like you found a flexcan bug :P should report that on NXP's forums
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-18-2020, 07:16 AM
    i noticed it intermittent locking up here as well while working on my library, it turns out if i don't include threads.delay(1) OR threads.yield(), it will intermittant lock up, most of the time. I am using...
    437 replies | 95776 view(s)
  • tonton81's Avatar
    06-18-2020, 05:05 AM
    the pins won't communicate if flexcan went into error passive state, it practically sits dormant till another node on the bus starts talking. this happens when it's trying to transmit and not getting a response (single...
    24 replies | 335 view(s)
  • tonton81's Avatar
    06-18-2020, 04:24 AM
    I wouldn't be surprised if it's a hardware bug since CAN peripherals on same chip behave differently, considering they're running the exact same legacy code, wanna try the github copy if you have time since you can test...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-17-2020, 03:10 PM
    Receiver: #include <FlexCAN_T4.h> FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_64> Can0; void setup(void) { Serial.begin(115200); delay(400); pinMode(6, OUTPUT); digitalWrite(6, LOW); /* optional tranceiver enable...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-17-2020, 02:57 PM
    yes both nodes update7, CAN3, using PJRC breakout board
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-17-2020, 09:17 AM
    Forum only update currently, teensythreads support for MCP23S17, allows shared SPI bus with a library mutex pointer passed in by a reference mutex from caller (setMutex()). Not specifying setMutex runs normal...
    15 replies | 962 view(s)
  • tonton81's Avatar
    06-17-2020, 05:48 AM
    msadie, I plugged the code back in, your sketch: #include <FlexCAN_T4.h> #include <elapsedMillis.h> FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_128> LCAN; elapsedMillis tsk1000msCounter; CAN_message_t msg0E0; void...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-15-2020, 04:42 AM
    you can keep a volatile flag set to 1 every time a frame comes in from callback, then have a volatile millis() counter do a timeout in loop if it is not updated from same callback. this would then set the flag to 0....
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-14-2020, 05:14 AM
    2016 civic touring sedan. they are full and overrun because no callback was made and nothing was removing frames from MB, in your demo. I reflashed the EPS using the comma2 which was done by flashing a fork that made it...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-13-2020, 10:39 PM
    https://github.com/tonton81/Circular_Buffer you can use this to setup as many buffers as you like, but they must be a power of 2, so if you want 10 you'll need to use 16 instead. you can then indefinately write new...
    4 replies | 168 view(s)
  • tonton81's Avatar
    06-13-2020, 09:37 PM
    LCAN Setup: FIFO Disabled Mailboxes: MB0 code: RX_FULL MB1 code: RX_FULL MB2 code: RX_FULL MB3 code: RX_OVERRUN
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-13-2020, 07:28 PM
    would you like to store 10 last values of ADC readings for each sensor and read them later? you can use a circular_buffer for that
    4 replies | 168 view(s)
  • tonton81's Avatar
    06-13-2020, 04:45 AM
    oh yes, but the honda electronic power steering (EPS) controller is limited to 10degrees. Although openpilot works well for L2 autonomous driving with driver assistance the lack of torque constantly annoys you during...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-12-2020, 06:51 PM
    yeah it just doesnt make sense how the library can be assumed the problem when the loop is controlling the increments in 1 second interval, to have 2 runs of increments in that second. some weird voodoo there :P your...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-12-2020, 05:08 PM
    it was set public for both for custom masks before they were implemented, then went private when user masks were supported in CAN2.0 mode. FD was not touched EDIT, msadie the count and increments look correct, but...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-11-2020, 04:59 PM
    you most likely have a code causing the crash by writing out of bounds, if you cant provide us code so we can help you see where problem is (even if its complex) theres not much we can do except keep guessing. Perhaps...
    437 replies | 95776 view(s)
  • tonton81's Avatar
    06-11-2020, 12:56 PM
    maybe try posting your code? are you using mutexes to protect variables or peripherals shared between threads?
    437 replies | 95776 view(s)
  • tonton81's Avatar
    06-10-2020, 06:04 PM
    watchdog cannot be disabled unless it is in debug mode, i will need to check the RF what that mode affects, if DBG mode hinders operational features then it wouldn't be good to add, however, maybe I can add the option...
    11 replies | 581 view(s)
  • tonton81's Avatar
    06-09-2020, 05:03 PM
    just checked repo, you have an outdated version your overriding. setTx was changed to setTX couple updates ago. use github copy with latest patch
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-09-2020, 12:58 PM
    check out watchdog1 demo on github https://github.com/tonton81/WDT_T4/blob/master/examples/watchdog1_demo/watchdog1_demo.ino configuration is done in setup trigger is how long before the watchdog callback fires...
    11 replies | 581 view(s)
  • tonton81's Avatar
    06-08-2020, 10:54 AM
    i see you are using delay(100) in your loop() for the MCP. You can copy the frame i posted earlier to the loop and add delay(100) as well, but later on dont use delay() as its blocking, unless you dont plan on adding...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-07-2020, 02:43 PM
    if there is a transceiver issue, you may not be able to see data between teensies. usually if you can test it reading on the car bus, if it works there you should be able to communicate without problems knowing the...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    06-01-2020, 01:01 PM
    New update: getRXQueueCount() and getTXQueueCount() added. As requested over at github by jeremy: https://github.com/tonton81/FlexCAN_T4/issues/9 It adds the ability to filter based on arbitrary masks, very...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-28-2020, 02:18 PM
    RX and TX? RXQSize() TXQSize() ? still unconventional naming in the arduino field, still deciding :P
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-28-2020, 12:50 PM
    no need to write it low, its low by default when set by pinmode to output, maybe try putting volatile asm "dsb" after pinmode? EDIT, a resistor like kurt said is recommended, as the pins are in high-Z whenever teensy...
    5 replies | 153 view(s)
  • tonton81's Avatar
    05-27-2020, 10:47 PM
    sure, we just need a name for the function to return size for rx and tx
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-27-2020, 08:35 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    for now, until i figure it out
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 08:28 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    yup, queue management issue (with or without interrupt probability)
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 07:51 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    if the lockup is from callback or loop(), serial prints usually find where the last line locked up. if its from an isr then prints wont work unless you put them in library if you are only doing 12 bytes, you can do...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 07:30 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    its probably an overlap between nodes that would need to be fixed, on the reassembly side (receiver). if it locked up, it doesnt tell me if it was an array overlap or a memmove transfer injected to wrong array, its been...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 06:32 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    yeah once they drop off the active list, transfers to them are blocked, the timeouts made me work on that to prevent delays caused by missing nodes by making sure theyre on the list before sending
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 06:23 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    maybe theres an issue with the displacement of 2 transfers, can you try with only one node to see if it still crashes master?
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 06:06 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    what happens if you use broadcast (Node), does the other slave freeze?
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 06:03 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    not sure, skpang used it to transfer images (pictures) over CAN to display on a remote LCD, so that being a higher size of bytes I am thinking its a code issue as well :P
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-27-2020, 05:53 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    check the constructor TX_SIZE, keep it a power of 2, it's gotta be able to be big enough to support your array size in 8 bit chunks. 8x16 = 128bytes max, have you tried normal one dimensional arrays rather than structs?
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-26-2020, 10:37 PM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    yes, correct, for bus self recovery to work it must see valid frame bits on the bus, which will drop the TX overflow errors and the controller would go back online. There is no command for forced bus recover, but it...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-26-2020, 12:41 PM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    thats normal because with 2 nodes on the bus the nodes couldn't self-recover if both went into passive error state, with no other traffic to acknowledge. ideally the bus is not supposed to be shorted especially for long...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-26-2020, 04:38 AM
    not sure how to approach that, still confused on your explanation. ohhhhh i see what you are saying, well FIFO for RX receives in order as long as you dont have any RX mbs taking frames from it, then seq them to the...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-25-2020, 10:47 PM
    I'm glad the transmit from ISR is working for you, that shows progress. I am not too technical on the 1 bit term, or why you need 2 mailboxes for sequential, or which of the 2 would release first, but in the isr (per...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-25-2020, 10:38 PM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    Serial was implemented, there was more to be implemented, like remote I2C, SPI, analog, digital pin access. what i liked about the global method is for synchronizing multiple MCU gpio pins over a single message. Node...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 06:50 PM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    yes thats why Node.sendMsg is there, all nodes will get it :)
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 06:01 PM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    it will automatically adjust to the size on the network. lowest DLC to support global nodes, DLC of other node if capable of sending to it's size, otherwise it will use lower size automatically. CANFD is "up to" 64...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 05:09 PM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    it's a singleton, either can be used to set the ID of local node
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 12:47 PM
    Here is a new test of transmit interrupts! redesigned starting from the github copy. Transmit interrupts are enforced now, there is no way to disable them without breaking isr & loop handling of TX queues. Test ran...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-25-2020, 10:09 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    TeensyCAN node36 = TeensyCAN(36); if you have nodes 2 3 8, on node 2, put: TeensyCAN node3 = TeensyCAN(3); TeensyCAN node8 = TeensyCAN(8); on node 3, put: TeensyCAN node2= TeensyCAN(2); TeensyCAN node8 =...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 09:59 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    check the constructor for node100, that points to the node you want. on the other nodes, you add the nodes you want to control as well. this is a 2way library where they are all multi-master. the nodes are...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 09:55 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    basically, Node sends to all nodes, its global, whereas your specific node100, only receives the data. if you do Node.Serial.println("hello world");, all nodes will print that to Serial port. if you do that to...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 09:46 AM
    no dont do that, that puts the controller in HALT mode, the imask bits need to stop the controller to change them, and you also disabled any mailbox interrupts as well events() wasnt used during my tests, so it can...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-25-2020, 03:49 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    yes' correct. well they receive, you need to put something to transmit so the other teensy can see it. CAN_message_t msg; msg.id = 0x123; Can0.write(msg);
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 02:46 AM
    tonton81 replied to a thread TeensyCAN in Project Guidance
    you need to use FlexCAN_T4 constructor, not FlexCAN_T4FD, and use CAN1 instead of CAN3 Also, it's good to run one of the FlexCAN_T4 demos to confirm your connections are good before working on TeensyCAN as it relies...
    51 replies | 1661 view(s)
  • tonton81's Avatar
    05-25-2020, 02:36 AM
    I reverted the interrupt transmits as it wasn't stable compared to the loop, and made all transmits not able to occupy a mailbox into the TX queue, not just sequential ones. Loopback mode and wake up mode have been kept...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-20-2020, 04:56 AM
    yes this is why these are tests for new update later on, thats why I didn't want to touch the repo, I'm a bit busy this week but I'll try to work on it more
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-19-2020, 04:19 AM
    only reason i moved it was because something was throwing off between sequential or remote frames, but that may have been fixed somewhere else or that line was necessary, Im testing 3 types to make sure itll work. so...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-19-2020, 03:32 AM
    thats weird, I just left the house and it was working using the 2 sketches posted, ill check it again when i get home from work
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-19-2020, 02:55 AM
    EDIT, update, can you try this? Seems to work now for sequential and non sequential with no events() in loop(). As for remote frames they seem to be causing their own problem in sequential, so those ones i force to any...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-19-2020, 01:28 AM
    lack of traffic you must use events(), it'll receive one and dequeue one or more transmits. without events() the transmits only happen whenever the ISR is firing, like from receptions. otherwise you need to include...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-18-2020, 02:19 AM
    RFP30N06 Logic level mosfets
    3 replies | 139 view(s)
  • tonton81's Avatar
    05-17-2020, 09:18 PM
    Added your code correction, except rather than adding a line I moved: txBuffer.pop_front(); /* clear on write */ code = 0; /* MSADIE - clear code before configuring for new tx frame */ // deleted ...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-17-2020, 06:44 PM
    The interrupt needs to be enforced to be on even if the user hasn't implemented it, otherwise the transmits won't fire from the ISR, and it would break remote frame capability in the ISR since flexcan switches the MB to...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-17-2020, 04:52 AM
    Just added wake up on traffic support. You can call: asm(" wfi"); in your code to goto sleep. The loop() will stop scrolling after shorting out the CAN lines when the wfi enters sleep. Removing the short on the CAN...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-17-2020, 03:58 AM
    thanks, I was worried about the weight at first on the glass desk, but the back and front legs line up easily on the cross bars under holding the glass, so no pressure on the glass itself, the width is just perfect for...
    323 replies | 21574 view(s)
  • tonton81's Avatar
    05-17-2020, 03:27 AM
    Well finally got my monitor today, first time I ordered one online after having a dead one for couple months! Fits perfect on the desk lol....... Anyways, I started working on flexcan code, I will post test...
    323 replies | 21574 view(s)
No More Results
About tonton81

Basic Information

About tonton81
Biography:
Seriously? ;)
Location:
Montreal, Canada
Interests:
computers, micros, telecoms, gate systems, access systems, security systems, cars
Occupation:
sorter/driver/shipping

Statistics


Total Posts
Total Posts
3,378
Posts Per Day
2.60
Last Post
FlexCAN_T4 - FlexCAN for Teensy 4 07-06-2020 01:41 AM
General Information
Last Activity
07-08-2020 05:15 PM
Join Date
12-18-2016