Forum Rule: Always post complete source code & details to reproduce any issue!
Tab Content
  • tonton81's Avatar
    Today, 05:05 PM
    Since Paul found a patch for the reset I started working back on the watchdog interface. The previous version was only for watchdog1 (WDOG1). This redesigned model is templated, and works on ALL 3 watchdogs...
    2 replies | 27 view(s)
  • tonton81's Avatar
    Yesterday, 10:20 PM
    Alternate pins are possible but not yet implemented in the library, it will be added soon though
    9 replies | 358 view(s)
  • tonton81's Avatar
    01-24-2020, 09:24 PM
    It will read from all mailboxes, but if you dont write fast enough only MB0 will be populated, in terms of efficientcy, unless your blasting frames they wont roll over to the next mailbox unless the first mailbox isnt...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    01-24-2020, 02:11 AM
    Please use msg.flags.extended = 1; This flag notified the transmit mailbox that it's an extended frame, otherwise it will be truncated as a standard ID by default. I tested just now to confirm extended frame is working...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    01-24-2020, 01:20 AM
    The RX and TX queue are sized from constructor, as a power of 2. The write is complete (but not yet transmitted) when a TX mailbox is available and your data is written to it. It is non blocking, and relies on the...
    201 replies | 16622 view(s)
  • tonton81's Avatar
    01-20-2020, 09:11 PM
    Yes i know, the buffer data of RTR requests are unused, even if the buffer is populated (they are filled) the hardware doesnt actually transfer them, the length is to be used when the RTR response is to be given, the...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    01-20-2020, 08:01 PM
    You should remove this: /Users/sellensr/Documents/Arduino/libraries/SD It shouldnt be in your libraries folder unless you specifically put it there purposely for some testing or usage The library folder takes...
    10 replies | 235 view(s)
  • tonton81's Avatar
    01-20-2020, 07:50 PM
    holynoise, I was just thinking, with enhancements off and in multi ID mode, your original ID may probably work Can.setMBFilter(MB1, 0x14060050, 0x1406FF50); /* 2 ID multi-ID mode, non-range based */...
    201 replies | 16622 view(s)
  • tonton81's Avatar
    01-20-2020, 07:42 PM
    Did you upload the wrong file? This compiles fine and shows no errors?
    13 replies | 154 view(s)
  • tonton81's Avatar
    01-20-2020, 07:33 PM
    If you provide the hex file on your website, you can make a batch file with the teensy command line uploader, that way a user just has to double click the batch file and it will upload
    2 replies | 46 view(s)
  • tonton81's Avatar
    01-20-2020, 05:59 PM
    Usually start at the top most error to solve problems, the remaining ones usually follow the initial cause. A full report should be posted of compiler as well as a test sketch so people can check it on their own Teensy...
    122 replies | 8385 view(s)
  • tonton81's Avatar
    01-20-2020, 01:54 AM
    DMA support is now added as well as remote frame transmit support. Reception of remote frames works fine as is from what I see, they goto your callback where you handle the data needed to send the frame reply back ...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    01-19-2020, 10:37 PM
    Ok, ill check that out after the DMA code
    143 replies | 7607 view(s)
  • tonton81's Avatar
    01-19-2020, 10:15 PM
    Sending RTR frames is on my todo list. Receptions should be fine though. I am currently working on the legacy DMA FIFO (only available on CAN3) and will circle back to RTR afterwards. Just to confirm, it's transmit only...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    01-19-2020, 09:19 PM
    Yes,ironically the watchdog which is burnt in the headunit which forces a reboot during a warp snapshot due to it not toggling the watchdog, causes the snapshot to.be corrupt, thus only way to recover is to unlock the...
    10 replies | 185 view(s)
  • tonton81's Avatar
    01-19-2020, 05:25 PM
    A little off topic, but the NEX pioneer series uses a similar mcu as teensy 4, when doing a warp snapshot a hardware modification is needed, simply a pullup on the timeout line just to prevent the watchdog from...
    10 replies | 185 view(s)
  • tonton81's Avatar
    01-17-2020, 05:32 AM
    You have "X" amount of mailboxes in TX mode, if you constantly write faster than they deplete they wont be able to output and a return of 0 will occur until at least one is available to write. Next, the sequential...
    201 replies | 16622 view(s)
  • tonton81's Avatar
    01-14-2020, 05:40 AM
    If you have more than one mailbox accepting the same frames, then they can be in any order. Thats why people have 2 options. Ordered by FIFO, or run single mailbox mode (reject the rest or switch them all to TX). ...
    201 replies | 16622 view(s)
  • tonton81's Avatar
    01-13-2020, 11:59 PM
    All bits (0x14) must be set to checked so no you cannot omit it, the hardware will simply toss it out as bad match, everything else is ok. Your filters are done in hardware for best performance, so its up to the SMB to...
    201 replies | 16622 view(s)
  • tonton81's Avatar
    01-13-2020, 05:27 PM
    Are you looking to only save 2 IDs? Mailboxes can be completely custom configured. If you plan to use filtering it is highly recommended to put your priority ID filters in the leading mailboxes and have the catch-all...
    201 replies | 16622 view(s)
  • tonton81's Avatar
    01-08-2020, 09:42 PM
    This may be slightly off topic but i am using skpang's board and able to use both external and usb at same time, i havnt checked the datasheet or if the trace was cut as i ordered them together to be assured i wont have...
    24 replies | 471 view(s)
  • tonton81's Avatar
    01-08-2020, 06:15 PM
    Some features are specific to arrays, some to buffers, most work on both. It wouldn't be ideal to have seaparate names when there are alot of features to be handled would increase the function list, as long as it is,...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-08-2020, 06:02 AM
    Cb.remove is a unique feature implemented specifically for circular arrays, not circular buffers. The function only processes on circular arrays, and exits on buffers. It's used to drop an entire array out of a queue of...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-06-2020, 12:13 PM
    Ok, I corrected the offset needed of memmove on peekBytes, and readded it to readBytes, both function correctly. It's been updated on github, let me know if you still have issues :) My last example posted earlier...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-06-2020, 04:20 AM
    Thank you, I will check into that and fix it when I get back home readBytes is good now?
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-05-2020, 05:23 PM
    Have you tried a different compiler optimization? Smallest is default for LC, what happens when you try Fastest? Compilers sometimes may optimize things out, if there are code issues
    26 replies | 264 view(s)
  • tonton81's Avatar
    01-05-2020, 01:42 AM
    Ok try the patch https://github.com/tonton81/Circular_Buffer Test example: #include "circular_buffer.h"
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-05-2020, 01:22 AM
    can you post a full sketch i can load it to a standalone teensy to test? Last post is a snippet EDIT, nevermind, I see the issue with readBytes. That will need to be fixed.
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-05-2020, 12:43 AM
    Serial.printf("%lu: cb_trans contains = %d elements\n", millis(), cb_trans.back()- frontptr); Have you tried using the now pointed to array as references? &frontptr &xxxx.back() etc ...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-04-2020, 11:15 PM
    Front and back are just a pointer in CBA. Example: cb_trans.front(); This basically gives you the data stored in indice 2 of the front of the queue. Same goes for back(). This is just a pointer, basically, to your...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-04-2020, 08:44 PM
    The type for the buffer, is guarenteed to be the type you used in the template constructor. uint8_t, it is impossible for the compiler to generate a different type than the one you specified to the template parameter....
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-04-2020, 07:02 PM
    Have you checked .size() for number of elements? Perhaps your calculation is wrong, try size() to confirm back() and front(), by the way show the byte in either head or tail of the queue In printf, also, %d is...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-04-2020, 05:13 PM
    Dont worry, theres more features there than you realize, which makes data entry and data lookups one of the excellent features of circular arrays. :)
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-04-2020, 11:39 AM
    Yes when i made the function in previous libraries in past i made them weak, in case some other user code or library implemented their own.
    26 replies | 1000 view(s)
  • tonton81's Avatar
    01-04-2020, 05:40 AM
    1 is correct, but back is a READ pointer as well. Thats how you pull LIFO. size and available are the same, due to common usages between programmers, spme may prefer one over the other. Capacity is the size given in...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-03-2020, 05:31 AM
    That is true, but in the case of a T3.2 there is only one bus instantiated. On a T3.6, you can instantiate 2 CAN controllers, except this time unlike last libraries, choosing one won't duplicate code and enable...
    6 replies | 197 view(s)
  • tonton81's Avatar
    01-03-2020, 05:07 AM
    I could add print(ln) to circular arrays, it just wasnt added because it was just implemented in the buffer instead. If i do add it, though, since text has an arbitrary size, you will need the length() method which...
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-02-2020, 11:51 PM
    Templates are awesome, objects are created during compile time, very different than run time objects. FlexCAN_T4 demonstrates how compile time objects can be linked to run time objects, in order to control the template...
    6 replies | 197 view(s)
  • tonton81's Avatar
    01-02-2020, 03:05 AM
    print_test is a multidinensional array. The print functions are for the circular buffers not circular arrays, it stays at 0 because the function aborts. This is expected
    176 replies | 13320 view(s)
  • tonton81's Avatar
    01-01-2020, 10:29 PM
    When you do a read it pulls the item out of queue, by the time you check the size it'll be empty
    176 replies | 13320 view(s)
  • tonton81's Avatar
    12-30-2019, 12:02 AM
    Mailboxes are there even though you use FIFO or not, depends how advanced the configuration is set by the user. FIFO technically can't tell you how many are in queue (1-6), only yes or no, typically same response from a...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-29-2019, 08:06 PM
    It will return 0 of there are no more messages filling one or more mailboxes. 1 is returned when at least one mailbox was read of an available message. There is no other way of counting especially if the stream is too...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-29-2019, 07:30 PM
    What do you mean? ((Can0.events() & 0xFFF000) >> 3) will show if there are frames in queue (in interrupt mode). Is that what you meant or you mean polling mode? None exists at the moment for poll mode, aside from the...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-28-2019, 06:39 AM
    Don't forget when changing the SPI mode to do a dummy read before asserting the line to communicate, this will put the clock to a known high or low state for next transfer and probably wouldnt have corrupts data between...
    10 replies | 222 view(s)
  • tonton81's Avatar
    12-27-2019, 12:07 AM
    Do you have proper termination on the lines? Verify the transceiver is not crosswired to the CAN network as well, the code looks ok so far, and your printing to serial monitor what your sending as well (which is fine...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-25-2019, 09:11 PM
    Yes, USB3 supports ~1500mA on the port itself while USB2 supports 500mA, thats why USB2 drives require a 2nd USB port for power (1A combined) while USB3 can just use a single port All USB3 drives are compatible with...
    388 replies | 12801 view(s)
  • tonton81's Avatar
    12-25-2019, 08:05 PM
    You can't modify msg in callback because its read only, you can copy it then modify the copy CAN_message_t theCopy = msg; // copy it theCopy.seq = 1; The data 0xFF looks good, just make sure it's the right offset...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-24-2019, 09:11 PM
    You can send both onReceive to same callback if you wish to handle it in one function, each frame has a msg.bus (1,2,3 is returned for CAN1,CAN2, amd CAN3. To send frames ordered sequentially, you can set msg.seq = 1...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-24-2019, 08:08 PM
    Yes printing too fast can actually lag the java window enough that the IDE freezes to a halt Same thing happens with full page refreshing in canbus debugger im working on, 1ms can lock up the IDE but 10ms is ok,...
    15 replies | 268 view(s)
  • tonton81's Avatar
    12-24-2019, 08:04 PM
    Yup that looks good, will add it today or tomorrow as a 2.0 example, the FD beta example needs to be updated as well.
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-24-2019, 07:24 PM
    Try using Can0.setClock(CLK_60MHz) then do setBaudRate after that, check if you have timing issues with that after. I am using skpang's breakout board in my car with a retail Teensy 4, it has triple CAN transceivers,...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-23-2019, 10:51 AM
    Looks good but only put Can0.events() in the loop, onReceive needs only be set once in setup, just move that to setup and remove the while loop The return value is used by TeensyCAN, 12 bits contain Rx buffer queue...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-22-2019, 06:35 PM
    On a side note you can also use Can0.setMBFilterRange(MB0, 0x800, 0x805); since the IDs are within a tight range You may also have a callback per mailbox, like have 0x800 goto one callback, 0x801 goto MB1 callback,...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-22-2019, 03:08 PM
    Can0.enableMBInterrupts(); is needed to enable all mailbox interrupt receptions (unless you rather poll as in your example) For the callback, you can call Can0.onReceive(canSniff); and add the function: void...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-16-2019, 11:04 AM
    You dont, it already ended when it hit the callback. If you can calculate the bytes by length and the stuffing bits need to be considered, ill have to read up on the details but would be a nice addition to the canbus...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-16-2019, 12:36 AM
    The counter is not needed you just need to time each frame, local timer, and how many, based on their data lengths: Check the last post on the NXP forum: Link
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-13-2019, 05:50 AM
    The hardware will not pass in corrupted frames, they are CRC validated, before it hits the software end. If you are curious try reading the data while a OBD tester tool is plugged into the OBD port, to see what is...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-12-2019, 07:11 PM
    You didn't do anything wrong, perhaps your car is using extended frames and not standard, this can be normal. The OBD responses on 2006+ cars are mostly extended id responses. If you are writing to that ID it may not...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-10-2019, 06:45 PM
    FlexCAN_T4 works on Teensy 3.2, 3.5, 3.6, and 4.0 You can also use IFCT for Teensy 3.x
    14 replies | 3040 view(s)
  • tonton81's Avatar
    12-05-2019, 03:52 PM
    The clock can be changed using setClock, default for Teensy 3.x is 16MHz, you can try up to 60MHz on T4 If there is an error in the setBaudRate function it's been there since the original teachop/pawelsky's...
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-05-2019, 01:12 PM
    CAN2.0 or FD mode? If CAN2.0 you can use 307200 for the speed
    143 replies | 7607 view(s)
  • tonton81's Avatar
    12-04-2019, 11:38 PM
    You mean like the sending struct? CAN_message_t msg; msg.id = 0x123; msg.flags.extended = 0; msg.len = 8; msg.buf = myTemperature; Can0.write(msg);
    1 replies | 123 view(s)
  • tonton81's Avatar
    12-03-2019, 06:27 PM
    Tie a gpio to reset pin ?
    64 replies | 16104 view(s)
  • tonton81's Avatar
    12-03-2019, 12:04 AM
    Calling new and delete dynamically will destroy your heap, not recommended for microcontrollers, be careful :)
    9 replies | 305 view(s)
  • tonton81's Avatar
    12-02-2019, 06:02 PM
    Try lowering the I2C rate to 100000 and/or try the alternate Wire library as a test, as for the wiring we can only assume you followed the site but we can't physically see that until you post pictures
    13 replies | 293 view(s)
  • tonton81's Avatar
    11-29-2019, 06:07 AM
    Dont know if this also helps, but the time slices of each thread can be changed which affects how long task switching stays in that thread, i had to adjust my time slices when i ran multiple uart displays in previous...
    426 replies | 88791 view(s)
  • tonton81's Avatar
    11-27-2019, 07:43 PM
    Define reliably? TeensyCAN is using the FD library to distribute 640 byte data with 64byte frames in about 1.5ms constistantly for days. If there is any issues in the FD library I usually respond to fix it within the...
    143 replies | 7607 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,192
Posts Per Day
2.81
Last Post
WDT_T4 - Watchdog Library for Teensy 4 Today 05:05 PM
General Information
Last Activity
Today 11:41 PM
Join Date
12-18-2016