Forum Rule: Always post complete source code & details to reproduce any issue!
Tab Content
  • tonton81's Avatar
    Today, 12:50 AM
    Slave's been pumping out since I left today, its still rolling along! :D didnt crash yet! I fixed Don's issue so my deed for the night is done, tomorrow I'll see what I can do with MST...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Today, 12:46 AM
    tonton81 replied to a thread uNav INS in General Discussion
    I am going to assume the above is correct. I commited the changes for you at the repo: https://github.com/tonton81/Circular_Buffer/commit/081d531256313d4c30713318361a4d4622dc5ee2 You can download the new update
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Today, 12:37 AM
    tonton81 replied to a thread uNav INS in General Discussion
    Is this correct max being closer to 0??? sketch snippet: Circular_Buffer<float, 16> myFloats; myFloats.push_back(-3.14159); myFloats.push_back(-12.3456); myFloats.push_back(-78.91234); ...
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Today, 12:29 AM
    tonton81 replied to a thread uNav INS in General Discussion
    Ok just to confirm, .max() should be closer to 0 right? and .min() is further back? .min(): -78.91 .max(): -3.14 -78.91234 -58.91234 -18.91234 -12.34560 -11.91234 -7.91234 -3.14159 min max correct?
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Today, 12:25 AM
    tonton81 replied to a thread uNav INS in General Discussion
    Ok Don, I'm home now, I'll fix it soon
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Yesterday, 11:59 PM
    well not really more filled, the secondary one was just if the first was “in-transition” otherwise i see no benefit in filling ones less full, especially if ordering is required, wait, thats also a doorstopper right...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 10:47 PM
    either way, this is looking good, ill spend some quality time on it :) if you got suggestions for tackling dual buffer system rather than a single only problem is can the isr fire 2x or more faster than the loop? im...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 10:31 PM
    that was in teensquitto thread i think :)
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 08:16 PM
    tonton81 replied to a thread uNav INS in General Discussion
    it’s also my fault, i started search at 0... T _find = 0; I should have started searches from endpoints... Also if you got a small snippet of just the CB to test against that would be nice, while i patch the lib i...
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Yesterday, 08:10 PM
    tonton81 replied to a thread uNav INS in General Discussion
    if that works its just a matter of printing the tail-1 after calling ascending, simple library fix using already implemented methods :) edit, if that works, i might use it for .min() as well, to be safe both ways
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Yesterday, 08:04 PM
    tonton81 replied to a thread uNav INS in General Discussion
    on the other hand, this mine be a ONE LINE patch! can you do a quick test for me? im not home try this make your queue to ascending order, (i hope c++ std:: orders them right) via CB.sort_ascending(); then get the...
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Yesterday, 07:58 PM
    tonton81 replied to a thread uNav INS in General Discussion
    Cool, is there a special way to calculate it then? I could always correct that error OH! I know what you mean now, ill figure it out tonight/tomorrow
    596 replies | 12127 view(s)
  • tonton81's Avatar
    Yesterday, 06:51 PM
    Not saying this is a solution or not, based on just test you could try to modify the NVIC register of Wire to be higher priority than interval timer, it worked for me using SPI interrrupts, stopped Wire from crashing :)...
    2 replies | 49 view(s)
  • tonton81's Avatar
    Yesterday, 05:28 PM
    Just swapped out the uint16_t for atomic bool, library seems to work with it... std::atomic<bool> SPI_MSTransfer::_slave_queue_active = ATOMIC_FLAG_INIT; std::atomic<bool> SPI_MSTransfer::_slave_dequeue_active =...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 04:38 PM
    OH MY!! Tim, I blasted the slave to write 0ms loops and ran ONLY events(0) in master loop, it was scrolling crazy with all data intact!!! i had to close the console it was flooding with the payload! :)
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 04:32 PM
    Well according to the console, all the data is comming in with uint16_t, so I can assure you we're safer now than we were with bool at the moment! :) We can always "update" the variables later on to std::atomic later...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 04:27 PM
    Tim, I've implemented the slave sending to master protection while writing, its working great now with the volatile uint16_t (even though im only using 0 and 1 value!) Should we do the CBA split, where half is...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 04:20 PM
    OK: Heres a log: VOLATILE BOOL: 1 0 1 0 1 0 1 0 1 0 1 0 1 0
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 04:15 PM
    Tim, this bool was holding me back wondering why half the time the slave was dequeueing nothing even though it said one queue, but the master never received it, in 1 sec intervals. ALL I DID WAS CHANGE BOOL -->...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 04:12 PM
    Question, I'm guessing BOOLs are not atomic? I seen Paul mention that uint8_t and other data needs multiple calls whereas native 32 writes are done in a single instruction? I setup the master to ONLY pull slave...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 03:21 PM
    Here's the example I did when I wrote the lambda handler for I2C: _wire_callback_active = 1; _wire_callback_readpos = 0; mtsca.push_front(buf, buf); ...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 02:58 PM
    Hey Mike, I had a brilliant idea... I was thinking of doing like I did to the lambda function, where the methods KNOW it's active or not... Just think for a moment, what if we create an additional CBA with 2...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 01:34 PM
    Last night I was so tired looking through the code... then when I woke up, I didn't even know how I walked to bed, I don't remember... I was just in bed lol...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 01:13 PM
    ok Mike, not to worry, it's a mix of problem... It's probably not events, but I have to fix the ISR switch statements first... The reason is theres a ISR flag & return in the wrong spot that I found and now im getting...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 12:56 PM
    ok i just wanted to make sure if older events worked on slave end while the latest thread test version was commented out on master, its puzzling but if i have to follow the steps in events() slave is getting the f&fs...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 12:00 PM
    yes i know, this happened since queue implementation, the events is suppose to fire when slave TELLS master its ready, can you try without events loaded on master with latest version, and try the github version flashed...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 07:31 AM
    Also please confirm if removing events() with latest copy here works in uNav (obviously sending data only to slave)
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    Yesterday, 04:12 AM
    yes i know, still working on it but i goto work soon :) if you comment out events()/remove it, master is sending fine i have to see where its crashing to fix it tomorrow if i have time (double shifts) post #1319...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 06:38 PM
    i narrowed it down, your sketch is running with the first section of events() commented out need to see where its crashing in there now
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 06:31 PM
    Heres another interesting thing, comment out events and try F&F's... its running fast! that means, its crashing somewhere in events()...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 06:10 PM
    Ok I figured it out, well not really, just narrowed it down... It's working if events() is in a thread, but not in a single nonthreaded sketch, it's something in events() I gather, gonna have to poke around to see...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 05:32 PM
    It's something stupid on master sketch, only master sketch, I write yours, I see that lag, I write mine, it rolls along nicely... still trying to pinpoint it...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 05:00 PM
    This is the master/slave im using testing F&F's Master: //#include "FastLED.h" #include <SPI.h> #include <i2c_t3.h> #include "A_ConfigDefines.h" #include <SPI_MSTransfer.h> #include "TeensyThreads.h" #include...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 04:55 PM
    https://www.youtube.com/watch?v=mhww6IfFbMo
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 04:51 PM
    events() ? post your code? :)
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 04:46 PM
    I tested transfer16's: OT_CALC==100 micros() _time==9 ACK PacketID 60: 5uS OT_CALC==100 micros() _time==10 ACK PacketID 60: 5uS OT_CALC==100 micros() _time==10 ACK PacketID 60: 5uS
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 03:23 PM
    The speed of the recovery is faster too now, to fire the lambda Keep in mind that the lambda fires only if the slave was ever reset, hotplugging doesnt count because the slave hasnt reset, so no need to reset it's...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 03:16 PM
    Ok, nailed it! if ( wire_port != -1 ) { if ( _wire_callback_active ) { uint8_t _shift = mtsca.peek_front() - available(); for ( uint16_t i = 0; i < size; i++ ) { if (...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 01:44 PM
    Yes, this was a problem for state check for slave to master data as well, the same system shares the queues, so this would fix those slow slave data capture issues
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 01:21 PM
    Hi Mike, I just got home from work, and I think I just found the bug too! Hope it works for you :) When I added the state checking, I was doing it the original way where it shifts the different state in first and...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 01:15 AM
    Theres still some timing things to work on for i2c, but at least i got it capturing payloads properly. I'll work on it tomorrow cuz i need a power nap before work ;P
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 01:01 AM
    Master: #include <SPI_MSTransfer.h> SPI_MSTransfer W0 = SPI_MSTransfer("Wire", 43, &SPI2, 30000000 ); void setup() { Wire.begin(I2C_MASTER, 0, 0, 0, 0, I2C_PULLUP_EXT, 100000, I2C_OP_MODE_IMM); ...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-17-2018, 12:13 AM
    Don't worry mike, i found that pesky bug that makes yours work or not, it turns out one of the calls deasserted and further down it did another SPI dword transfer before deasserting again, because it was already...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 10:53 PM
    Heres the peek() call from within the callback: Method hijack: (same as read, but no incrementer) if ( _wire_callback_active ) { if ( _wire_callback_readpos >= mtsca.peek_front() ) return -1; ...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 10:45 PM
    Ok now check the ::read() method: if the callback requests this: for ( uint16_t i = 0; i < count+2; i++ ) { Serial.print(W0.read()); Serial.print(" "); } Serial.println(); Keep in mind the 2 additional...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 10:20 PM
    Hey hey, this is fun :) Alright, check this: W0.read(buf, count); is different between normal and in callback. In normal mode, it requests to read from the slave's port directly
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 09:46 PM
    Here's the current working version for the last posts:
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 09:35 PM
    Oh I bet your wondering... Well... We have a huge buffer, why not use it!? Just thought of it now? Ideally, we would hook the Wire.read() calls to a special return, where a "read" would return the byte from the...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 09:21 PM
    I got it working! had to edit the slave's switch statement for dequeue to remove the flag if the queue contained the isr pointer case 0x9712: { switch ( data ) { case 0x0000: { ...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 08:56 PM
    wait thats wrong, its adding all new :O bbl nope, thats correct, i was going slow before so mostly addings :)
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 08:45 PM
    Looks like it worked! some debug info: dded new! Added new! Added new! Added new! Added new! Prevented double! Added new! Added new!
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 08:39 PM
    Alright I believe I have some results Mike. Noted above, it does work, but: No idea if it's because the master is sending to the slave i2c bus and pulling back over spi, but slowing down the I2C writes (not events())...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 08:19 PM
    yeah those are loop millis() printing, so i can see if it locks up or not when hot plugging :) single reads working here with above demo: 51777 Size: 50 Slave: 43 Port: 0 Hello World over I2C & SPI from...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 06:00 PM
    Yeah so use the single read bytes for that simple demo, its working perfectly, i'm still debugging the buffered reads :)
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 05:26 PM
    wow, that was fast, the teensy LC's just came in, I put them aside cuz im busy :)
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 05:18 PM
    May day may day, Not sure if it's i2c_t3 or SPI_MST the buffer reads are "intermittantly" working, im currently looking into it, use this hello callback temporarily for single reads: this always works: void...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 04:53 PM
    I'll make a very very simple minimal demo for you, gimme a minute, testing wire using buffer method and stripping master code Slave: #include <SPI_MSTransfer.h> SPI_MSTransfer slave = SPI_MSTransfer("SLAVE",...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 04:49 PM
    I think for testing, its easier to go thread-less, my sketch stuffing code cant play nice unless mutexes are well placed i emptied the thread loop and removed mutexes and pushed events into main loop where i can test...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 03:29 PM
    on the Master, 0x22 is set as a slave, programmed via MASTER -> SLAVE, at beginTransmission, you'll see the MASTER's Wire.* writing to 0x22 remember, W0.begin(I2C_SLAVE, 0x22, I2C_PINS_18_19, I2C_PULLUP_EXT, 100000);...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 03:15 PM
    definately, any and all calls that use the SPI_MST interface, MST_QUEUE is just a name i randomly picked, it can be whatever you want, as long as all those calls use the same one
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 02:47 PM
    Mike don't forget about the thread in the demo, if your using it i forgot to wrap the W0 transmission and the led, you can wrap them with the mutex from the other thread running events in the meantime ill be working...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 12:56 PM
    sorry W1 was just for testing the new Wire methods,, when I test the functions i basically throw them anywhere i can that i know where to start debugging :) you can clear that but yeah, you can see how the library...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 12:36 PM
    last night i realized i dont have read buffering support implemented for wire/serial, only writing... looks like ive got work to do today! :) its always preferable an entire buffer over a single transmission rather...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-16-2018, 12:33 PM
    tonton81 replied to a thread uNav INS in General Discussion
    unless it could be a bug in the usbserial buffer as well *just throwing that out for fun :P mmm wonder if increasing the usb buffering in the core will benefit these streaming datasets
    596 replies | 12127 view(s)
  • tonton81's Avatar
    04-16-2018, 01:08 AM
    you can use the ethernet library with an ethernet interface for teensy, to get full blown network support, then to make it wireless get one of those small ethernet to wifi modules that connects to wifi and plugs...
    1 replies | 80 view(s)
  • tonton81's Avatar
    04-16-2018, 12:21 AM
    Yup, the lambda is created in setup (or wherever you call it) and is binded to the object (lets say teensy_gpio). So it survives the lifetime of the object, not the scope. After creation, it self-fires to run the items...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-15-2018, 11:15 PM
    To better illustrate the behaviour you may test this out: The library: Master sketch: //#include "FastLED.h" #include <SPI.h> #include <i2c_t3.h> #include "A_ConfigDefines.h"
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-15-2018, 11:04 PM
    Tim, Mike, I decided to take a rest from I2C, I'm overkilling it. I just added a new feature to SPI_MST that I think you guys would like. It involved "slave reset state". If the slave reboots, or is plugged in last...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-15-2018, 08:52 PM
    Yup, it's nice we can receive from the slave, but I have no idea what to do about the onRequest event, where that outside master requests bytes from slave, I doubt the endpoint would accept a long wait currently this...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-15-2018, 07:58 PM
    Its funny how we have a slave bus running off a slave :D All the 4 busses should work into the same handler, the packet info will give you the slave ID and wire port it came from really getting crazy now :) It...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-15-2018, 07:47 PM
    tonton81 replied to a thread uNav INS in General Discussion
    Have you tried playing with the baro's port NVIC as a test?
    596 replies | 12127 view(s)
  • tonton81's Avatar
    04-15-2018, 07:13 PM
    I don't have the equipment you have for testing (your data hardware from other threads), but I could figure out what you want as long as the sketch starts up I can do some debugging to find out how to make it work in...
    44 replies | 1490 view(s)
  • tonton81's Avatar
    04-15-2018, 07:11 PM
    I2C_T3 has non-block read/write for master mode, very interesting, I added them to SPI_MST: virtual void sendTransmission(i2c_stop sendStop = I2C_STOP); // I2C virtual void ...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-15-2018, 07:01 PM
    I defined the CB in MST as static, which I was able to access via scope You can also put it straight in the CPP file directly without putting it in the H file, so it remains global, accessible via other...
    44 replies | 1490 view(s)
  • tonton81's Avatar
    04-15-2018, 06:01 PM
    I would probably add the list later on, still busy adding to the MST, it's on my todo list :) I like your demo graphics :P
    44 replies | 1490 view(s)
  • tonton81's Avatar
    04-15-2018, 05:57 PM
    Here's test sketches running the slave demo, obviously run master after the slave boots so the master calls the slave setup routine and it hits the slave properly Master sketch: #include <SPI.h> #include...
    1349 replies | 28682 view(s)
  • tonton81's Avatar
    04-15-2018, 05:13 PM
    depends? only the pointer is moved, no memory is shifted In the ring buffer mode: the value is retrieved when read, but not actually removed, the head (or tail) moves over. The only write that occurs is when doing...
    44 replies | 1490 view(s)
  • tonton81's Avatar
    04-15-2018, 04:57 PM
    I2C Slave callback firing, and printing from within callback: W0.begin(I2C_SLAVE, 0x22, I2C_PINS_18_19, I2C_PULLUP_EXT, 100000); W0.onReceive(hello); } void hello(size_t count, AsyncMST info) { ...
    1349 replies | 28682 view(s)
More Activity
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
1,979
Posts Per Day
4.06
Last Post
Project: SPI_MSTransfer Today 12:50 AM
General Information
Last Activity
Today 01:11 PM
Join Date
12-18-2016