Of course you can do it without variant code... After all, it's just code...
Note: Jump to bottom for quick answer
Life can be made easier, by using the pin name code, that I have in the variant stuff...
@PaulStoffregen that's not a bad idea, assuming async transfers are not needed
@KurtE I assume your suggestions would only work with the variant code? No way to do this without it?
I'm building a project using DevBoard v5 (based on a Teensy Micromod schematic, with SDRAM) , and I need to access SPI instance, but the standard pins 9,10,11, 12 (B0_00, B0_01, B0_02, B0_03) are being used by the eLCDIF instance.
There is a set...
@mjs513 (hope you’re feeling better!) @KurtE
Is there a way to do non blocking, partial transfers without setting a dedicated frame buffer?
I have two LVGL partial buffers in DMAMEM and would like to point the relevant one to the display driver...
From memory, the PD chip is only meant to power the second USB-C port (not the board) and it only does that if you bridge the middle pad (which is connected to the second USB-C port's V+ lines) to the PD's output. If you want the USB-C port to...
I've got the code above working successfully to output steroo audio stream to the Audio Shield
But I get an interrupt on each half word, as I am also loading one channel of one sample at a time.
This means at 44.1Khz sample rate, I am getting...
I added the CS_went_high check alongside the existing flag_transaction_completed.
Its running stable on SPI1 with 12cm jumper wires
if (MOSI_SNIFFER.flag_transaction_completed && MOSI_SNIFFER.CS_went_high)
{
// Serial.printf ("n=%d, "...
I’ve searched the forums for async UART but came up with nothing pretty much..
I need to send these 27 byte frames at a 1Khz rate
If there is something you know of, I don’t mind having a look/go at it
Done more testing, but unfortunately I can't get it to work too well on my bench using SPI instance on both devices.
The Slave (T4.1) looses sync from the master (DB5) after a while.
I moved the slave to use SPI1, and it's MUCH more stable on...
Tested it out - works with an extra group in between the two Teensies
But was sensitive to being powered from the same source
Now, I will test with Master being a custom Teensy Dev Board v5 and the Slave a T4.1
I’ll also go 32 byte payload to...
Note, my fork/branch is probably somewhat out of date, with the most recent cores. That is, I believe I am 6 commits behind the master
branch. At some point I will probably rebase on the current stuff. However, I am not sure if/when that...
Regarding 0805 is not possible when it comes to the IMXRT dependencies. Meaning caps and resistors that it need. As the space is very crammed. I suggest using what I use to minimise error and faults.
This thread is super long and I don’t have...
In order to avoid using custom cores to support the added pins for this project, we configured those extra pins on the MUX level, on a need to basis.
So using standard Teensy APIs on the newly exposed pins for Analog,Digital,PWM etc won’t work...
Prior post edits don't happen after some hour(s).
With the 16MB Flash it appears as a MicroMod. There are some added pins available ...
SDRAM works with an included library - see this to start: https://github.com/mjs513/SDRAM_t4
Yes, but there are a few catches. Code that I had working for T4 master and T4 slave attached.
(working as long as GND interconnect is short enough)
Other issues were in the way you let the master immediately trigger a next transaction. With...
Only a true decent ground plane, or a very short GND wire in between the two Teensies makes it work reliably here on my bench.
Very short means < 5 cm.
Without that, I get spikes on the SPI CS line. Where that line hits the slave SPI CS input...
I managed to reproduce. Sometimes. There's something unexpected happening. It works only if I put just a bit of capacitive or resistive load on the SPI CS pin on the slave T4...
What I think is happening is that due to poor ground plane...
I tested with nbytes == 27 and get the same odd behavior if I preset any values into the TX buffer
If I don't set anything in the TX buffer I receive the data fine.
I assumed nbytes had to be the same as the buffer size. I will change that and try again.
On both the T4 and T4.1 I am using pins 13 for CLK, pins 11/12 for MISO/MOSI, pin 10 for CS.
I am grounding both together via the ground pin next to pin 0.
@sicco I tried both 32 byte buffer and 512 - did not work well on either.
Here is my Salve side sketch
#include "T4_DMA_SPI_SLAVE.h"
volatile int n = 0;
#define BYTE_BUF_SIZE 512
#define MOSI_SNIFFER SPI_SLAVE
uint8_t TXbuf[BYTE_BUF_SIZE]...
@sicco still not having luck with sending back data from the slave.
I’ve set the master to send 32 bytes at a time, and the slave to receive 32 bytes into the buffer
But as soon as the TX buffer on the slave has values set, the whole thing goes...
Hello,
Here is another Theremin ! This one is very simple : a Time of Flight sensor for the pitch, and FSR for volume. The synth section is also very simple, just one oscillator, a LP filter, minimalist LFO and reverb. In fact, this project is...
Has anyone here been able to decompress a file using zlib? Have a working example?
I need to decompress a blob from an SQlite database that is stored on the SD card.
I can’t fins anything that would be specific for the Teensy or Arduino...
Do you have an example sketch for this?
In test_main.cpp you are still referencing the SD object in the begin function T41SQLite::getInstance().begin(&SD);
Perhaps just updating the library would be helpful :)
Thought I would mention, I got my quick and dirty cards back from OSHPark, and I did a quick and very dirty solder job on one
I ran a couple of the sketches I tried before, and they appear to be happier...
This make so much sense now that you mentioned it!
I set the buffer size to 32 and now it works as expected!!
n=0, [>27] <4d <03 <03 <03 <03 <51 <52 <53 <54 <55 <56 <57 <58 <59 <5a <5b <5c <5d <5e <5f <60 <61 <62 <63 <64 <65 <66 est. f_SCK =...
@sicco I've loaded your SPI DMA lib and modified the test sketch just a bit
#include "T4_DMA_SPI_SLAVE.h"
volatile int n = 0;
#define BYTE_BUF_SIZE 27
#define MOSI_SNIFFER SPI_SLAVE
uint8_t TXbuf[BYTE_BUF_SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9...
While that is a decent idea, I've already got the 9488 housed in my jog wheel and ready to go with the rest of the hardware
But my issue here isn't free ports - the T4.1 that I have laying around solved that.
It's mostly the async comms between...
@defragster I need 2 SPI ports for the slave + 1 for control so the T4.1 had what I need (using the SD card slot as the 3rd port)
To be honest, USB might work, but I have ZERO experience with it.
The base code on the master is ported from a...
SDRAM just means you can have spare render buffers besides the active one, it doesn't really enable more resolutions or bitdepths because the USB bandwidth is still the limiting factor.
If you wanted to integrate something like this on a board...
Looking at the SPI.cpp source code, in the async transfer method, it seems that it will only return false if it's unable to allocate a DMA channel, or if the channel is currently active
if (_dma_state == DMAState::notAllocated) {
if...
16bpp is possible at 640x480 but compression is required which can degrade the quality.
The limit is the USB bandwidth which maxes out at roughly 30MB/s. 60 frames a second of 640x480 using 16bpp = 60*640*480*2 = ~37MB/s. That's why these...
I'm not quite sure that your above code is non-blocking. Looks like it waits with de-asserting SPI /CS pin until all 27 bytes have been read and written. So during that time, other code will not run?
The idea behind the DMA SPI example that I...
Okay, I got a base program to run continuously on the master side
#include <SPI.h>
// SPI configuration
#define SPI_CLOCK 1000000 // 1 MHz
#define SPI_CS_PIN 10 // Chip Select Pin
EventResponder spiEventResponder; // EventResponder for...
If you look in the SPI.cpp cdoe you will see - IMXRT case in the version looking at about line 1828:
bool SPIClass::initDMAChannels() {
// Allocate our channels.
_dmaTX = new DMAChannel();
if (_dmaTX == nullptr) {
return...
Probably yes.
Is your Teensy the SPI the master or the slave? For both i did a DMA based code examples. This thread is about the master i think.
Is the 27 bytes payload to be transferred as first 27 bytes out and then 27 bytes in, or in and out...
Either would work, but Ideally byte in byte out.
One T4 is the Master, the other T4 is a Slave
If I could get DMA transfers working on the slave side as well it would be ideal.
Just as the master reads from the buffer and receives to a buffer...
Sorry, I have not been following this... Have you simply tried using the SPI library?
bool transfer(const void *txBuffer, void *rxBuffer, size_t count, EventResponderRef event_responder);
Could have your eventResonder method simply keep a...
Playing with the SdSPITeensy3.cpp code in steps.
//------------------------------------------------------------------------------
uint8_t SdSpiArduinoDriver::receive(uint8_t* buf, size_t count) {
#if 0
m_spi->setTransferWriteFill(0xff)...
I think maybe it didn't get enough exposure yet. It's the weekend after all.
All you need to do is figure out which Teensy pin DIN0 is, then you can use the sample code that Paul provided on the other thread.
If you load the GEVCU7 codebase into...
@sicco I'd like to implement DMA based SPI transfers on a Teensy 4
I have a 27 byte payload to send and a 27 byte payload to receive back, and let it run continuously
Ideally something similar to the async Tx/Rx on the STM32 platform:
/**
*...