Search results

  1. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    Thanks so much @KurtE! I haven't had time to work on this in the past week, but hope to in the next few, and will restructure based on your suggestions.
  2. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    Anything I can do to expedite this?
  3. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    @KurtE thanks, thats good to know! If you have any feedback on the PR as well, I'd also certainly appreciate it. Thanks again!
  4. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    It seems that this is not straightforward to do a minimal example of this, as it requires modifying SPIClass::transfer, since that function explicitly sets the frame size to 7 and DMA to single-byte transfers. I need to be able to do 16-bit transfers via DMA with the CS pin controlled by the...
  5. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    @KurtE Thanks! I misread the pinout. Pin 38 works too! I didn't realize that both pins were PCS0. (I will update the above post to note that too). I think I've got at least the beginnings of a handle on how to accomplish some what I'm going for, and when I get a minimal example of DMA-driven...
  6. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    Thanks so much @jmarsh and @sicco! @jmarsh that was a very good suggestion*, and I can indeed get CS0 to toggle on each byte. #include <SPI.h> #include <EventResponder.h> #define BUF_SIZE 10 uint16_t spi_tx_buf[BUF_SIZE]; uint16_t spi_rx_buf[BUF_SIZE]; EventResponder event_responder; volatile...
  7. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    @jmarsh i'd be happy to get this to work with any pin as DMA SPI-controlled CS. (My impression has been that the SPI library mostly doesn't really use the SPI peripheral to control CS pins; all the examples I've seen just toggle CS as a GPIO output before and after the transaction)
  8. C

    Minimal example of DMA-driven SPI with CS toggle every 8/16/32 bits?

    I've roughly got the asynchronous SPI.transfer(tx_buf, rx_buf, sizeof(tx_buf), event_responder) call to work , but I don't know how to get a chip-select line to toggle in between bytes/uint16s/uint32s (a feature I need to make some DACs and ADCs respond; they won't simply handle a long stream of...
  9. C

    USB Serial dying on Ubuntu 18.04

    Hi Paul, I've used both the Arduino serial monitor to observe this problem and my own simple viewer in python using the pyserial module (code below). When I run the python serial monitor (at least a second after plugging in the Teensy), I never observe any output. Are there any other monitors...
  10. C

    USB Serial dying on Ubuntu 18.04

    Hi! Recently (past week), I have been _consistently_ (3 separate machines) observing problems with Serial communication over USB on Ubuntu 18.04. My sketch is below, and have tested each computer using a fresh install of Arduino 1.8.13 and Teensyduino 1.53, and have also copied the udev rules...
  11. C

    Teensy 4.0 SPI.transfer causing program to hang/die when connected to SPI peripherals

    Thanks so much everyone for all your help! mjs513 - Sorry, that was definitely info that should have all been in the first post! I'll definitely work on explaining my problems better! mborgerson - thanks so much! this definitely fixes my test program, and provides some insight to me as to...
  12. C

    Teensy 4.0 SPI.transfer causing program to hang/die when connected to SPI peripherals

    Thanks for your help! mjs513 - I have read this datasheet a good several dozen times. I dont understand how this relates, as my problem is not writing to the DAC, it is with the SPI output of the Teensy itself. My problem occurs in the Teensy 4.0's SPIClass::transfer(const void * buf, void *...
  13. C

    Teensy 4.0 SPI.transfer causing program to hang/die when connected to SPI peripherals

    Hi mjs513. I unfortunately cannot post my full circuit design. I also have not tried this with other Teensies (though have used Teensies 3.2,3.5 and 3.6 extensively in previous projects), but I also need to use the Teensy 4.0 for this project as I need the speed. As I mentioned in a previous...
  14. C

    Teensy 4.0 SPI.transfer causing program to hang/die when connected to SPI peripherals

    I have found that this issue continues even when only SCLK (pin 13) and GND are connected to my custom PCB. This occurs when my custom board is both powered or unpowered. The clock line is driving 36 SPI-compatible ICs (34 ADG1414s, 1 LTC2668, 1 MAX11156). Weirder still, if instead of placing...
  15. C

    Teensy 4.0 SPI.transfer causing program to hang/die when connected to SPI peripherals

    So far as I can tell this is not the case (or at least, MISO and MOSI are not crossed). Any advice on where I should look to learn about what this overflow practically means about the inputs? It would help me to understand how a badly-behaved MISO or MOSI line could cause this overflow. Thanks!
  16. C

    Teensy 4.0 SPI.transfer causing program to hang/die when connected to SPI peripherals

    On Teensy 4.0, MOSI is pin 11, MISO is pin 12 I believe, and that is what my design uses. If they were backwards though, how might this explain that result? My MOSI line is driving many devices, the MISO line is driven by only one device (an ADC), and is probably high-Z (but might be high or low...
  17. C

    Teensy 4.0 SPI.transfer causing program to hang/die when connected to SPI peripherals

    Hi! I'm using a Teensy 4.0, and I'm running into an issue where my code gets stuck when I try to communicate over SPI. This likely is due to some kind of hardware mistake on my end (see below); however, I can't figure out what I'm doing wrong and would love any suggestions anyone might have for...
  18. C

    Setting elapsedmillis within interrupt?

    Hi gfvalvo, I agree with your assessment and I think I worded my newfound understanding poorly. I agree that I would not expect your code to have this problem, as you're enforcing an evaluation order: 1) assign localFameMillis = tLastNewFrameMillis; 2) assign currentTime = millis(); 3) evaluate...
  19. C

    Setting elapsedmillis within interrupt?

    I can also replicate this using a 2nd teensy (a 3.5 but i figure that's irrelevant) generating 50us pulses at 20Hz. Teensy 3.5 acting as pulse generator on pin 1: void setup() { pinMode(1, OUTPUT); } void loop() { digitalWrite(1, HIGH); delayMicroseconds(50); digitalWrite(1, LOW)...
  20. C

    Setting elapsedmillis within interrupt?

    A bit more debugging revealed that the program was evaluating "if(tLastNewFrame > resetTime)" as true, under conditions where that absolutely should not have been true. I tried to capture this by printing tLastNewFrame inside the if statement, but tLastNewFrame evaluated to 0 when I then...
  21. C

    Setting elapsedmillis within interrupt?

    I ran it for 3.5 hours and saw no resets. I switched over to my camera, and saw a couple resets within half an hour. The camera is outputting a 50us 5V TTL pulse, that up until now I've assumed was perfect, but now I'm suspicious of. Is it possible to interrupt an interrupt? Like, if two rising...
  22. C

    Setting elapsedmillis within interrupt?

    Thanks! I'll run your test today and get back to you. It sounds like what I'm seeing isn't obviously due to my surface-level understanding of how interrupts or elapsedMillis objects behave. Maybe the culprit is something outside of my code? I'll keep digging around, and will get back to you...
  23. C

    Setting elapsedmillis within interrupt?

    I'd tried the volatile elapsedMillis approach and found the compiler didn't like it, and will try doing it directly via millis() with a a volatile uint32_t time variable. Regardless of whether that fixes it though, I'm curious though whether one would expect it to fail the way I did it...
  24. C

    Setting elapsedmillis within interrupt?

    I have a teensy 3.2 that I am using to count TTL pulses coming from a camera (one per frame, roughly 20Hz). I am using an interrupt to count rising edges on pin 8. Every 5 ms, the teensy reports the frame count to a computer via Serial. If for some reason the camera doesn't send a pulse for 2...
Back
Top