@RayLivingston Its good idea!! Yes its very near to SPI
BUT there is a question,
Teensy can work in slave mode? (Some said on a forum teeny works only in master mode)
![]()
@RayLivingston Its good idea!! Yes its very near to SPI
BUT there is a question,
Teensy can work in slave mode? (Some said on a forum teeny works only in master mode)
![]()
What does the processor's datasheet say?
The SPI library only supports SPI master mode, where Teensy selects the chip to communicate, driving SCK and MISO, and receives on MISO.
![]()
You'd have to write it yourself to implement DMA anyway. Start by finding out what the hardware supports.
I asked in the pcjr-forum your question:
Hi everybody,
using the pcjr-forums seems to be complicated compared to arduino-forum.
I'm asking this for another user who encountered IP-blocking when trying to access the PCJR-forum himselffirst of all a test if I can insert a picture-link as drag and drop seems not to work
no preview here so I will see the result only after posting it.
https://europe1.discourse-cdn.com/ar..._1035x211.jpegIs this possible with a teensy 3.5 to read in at this clock-speed?
Are any special configurations nescessary like setting a higher interrupt-priority?
Does the teensy 3.5 (Arm-4-Cortex) offer any kind of internal hardware that can read in the bits?
As there are ony 20 databits would it be possible to use an UART?
I guess the hardware-UARTs want to read in 8 bits per byte which would not match 20 bits
would it still be possible?
Can the receiving into the hardware-UART be interrupted after each 3 bytes?
8 bit byte 1
8 bit byte 2
8 bit last 4 bits ignore next 4 bits
drop 16 bits
start over receivingCan the I2S-interface receive at 2 MHz?
If a teensy 3.5 is to slow. Would a teensy 4.0 clocked with 600 MHz be fast enough?
Do you happen to know any other kind of microcontroller that would be able to read in the 20 bits at 2 MHz clock?best regards Stefan
and I got this answer
Seems like this is SPI slave mode. Teensy's standard SPI library does not support slave mode, but if you look at the SPI page of the PJRC site, you'll see links to libraries for SPI slave mode, several of them by user @tonton. You may have to get into the details on how to do 20 bits, but you have the necessary signals data, clock, and sync (select). You also would have to make sure you can set things up enable receive on select high, and begin sampling on first falling edge of clock after sync rising edge. Others will be able to provide more specific help, and you can usually find useful forum threads just be searching in google, such as "Teensy 3.5 SPI slave"
with DMA spi I found this
as your final purpose is to just strip off 4 bits from the 20 bits to have 16 bits left
this might be possible by using the sync signal as what it is syncing
and then switch a fast switching logic gate or a fast switching transistor on/off for the 16 bits
Depending on which 16 bits you want to keep this might be possible in pure hardware logic gates
and again liek so very often: describing the final purpose offers new solutions
best regards Stefan
Actually, the Teensy SPI library supports DMA out of the box, but only in Master mode. I've successfully used it for driving SPI-like LED strips. You can see how it works in the source code. The function signature in SPI.h:
bool transfer(const void *txBuffer, void *rxBuffer, size_t count, EventResponderRef event_responder);
The implementation is in SPI.cpp and starts with:
//=========================================================================
// Main Async Transfer function
//=========================================================================
bool SPIClass::transfer(const void *buf, void *retbuf, size_t count, EventResponderRef event_responder) {
Looking at that you can get an idea how SPI Master DMA is implemented. But, it will take some work to implement it for Slave mode.
I had also considered I2S / TDM for @dinamics2 before suggesting SPI. Believe me, it's not for the faint of heart, much more complex than SPI. I spent hours pouring over the processor's datasheet before I was able to do what I wanted. And that was with the guidance provided by the source code of the Teensy Audio Library. But it is a possibility and it supports DMA.
Yes, convert one stream of data to another, a niche for these devices.
If you divide your clock speed by the desired rate of conversion you have perhaps 90 cycles on a 32-bit RISC for each to finish and ready for the next.
Once you know the cycles needed, a faster board will answer deficiency.
With SPI, data can flow both ways at the same time. Neither device need wait on a clear channel.
Your english is better than most of my neighbors. Class warfare in America did that starting 1981. by 1985 the average SAT score was down 100 points and the answer --- an easier test just for us, a dirty bandage for a wouind. What can I say, I finished school and military before 1980 and still wonder what I served for?
Nick Gammon on SPI including How to Make an SPI Slave.
He tells the why for every bit.
AVR UARTs are capable of being Master Mode SPI if you need an extra channel.
OP is using Teensy 3.5, not an AVR-based board.
Is the speed problem about communication limited rate?
I had naively assumed that if it can be received, it can be sent....
but no, not nesessarily.
Perhaps one answer is to put the Teensy on a PC bus card or maybe now make a cable to the pins on a single board computer like Raspberry Pi, even the Zero?
Thanks for everyone, you all are great!
Any one kindly share more details regarding FlexIO,
I am still unable to open prjc website.
FlexIO
FlexIO is a highly configurable peripheral, with a sort of build-your-own ports from a collection of shift registers, timers, logic and state machines. FlexIO can implement UARTs (serial), I2C, SPI, I2S audio, PWM. Unique interfaces can also be built, such as the TriantaduoWS2811 library.
Its only for teensy 4.x ?
As always, start with the processor's datasheet.
The Arduino Forum is part of a larger main site loaded with resources. One in general, try the math and performance snippets in the User Code Library!
The Arduino Playground, now a closed exhibit of How-To
it has many pieces of the one-size-fits-most-all answer if you want to roll your own. Just remember that transmission lines are antenna where flat traces vs round wires make differences but IIRC 2MHz is near low end of that. My EE Guru used terms like black magic in the mid-80's about if an arc of wire between 2 components curved left or right it worked right or not.
Beware like crazy trying to fix hardware issues in software! Pure Insanity!