jmarsh's latest activity

  • J
    Not without using a customised linker script and modified startup code.
  • J
    Static uninitialized data should be zeroed. Memory handled by malloc/free is not static, it is dynamic. If you want a dynamic allocation to be cleared when allocated you should explicitly use calloc. If you have int foo EXTMEM; then the value of...
  • J
    Why? Dynamically allocated memory does not need to be cleared.
  • J
    This PR includes zeroing PSRAM on startup, but the main aim is speeding up the dynamic allocations: https://github.com/PaulStoffregen/cores/pull/731
  • J
    It does but it shouldn't; it's a violation of C spec for uninitialized static variables to not be set to zero.
  • J
    You can order one from PJRC: https://www.pjrc.com/store/ic_mkl02_t4.html Why exactly would you want to replace the old one?
  • J
    jmarsh replied to the thread Using "SDIO2" for SdFat (SD card).
    Slightly related but also off-topic: it would be nice to know what the other USDHC pins are for (the ones that aren't DATX, CMD or CLK). I haven't seen any reference to them in the IMXRT manual. I can take a guess that "WP" is a write-protect pin...
  • J
    jmarsh replied to the thread Using "SDIO2" for SdFat (SD card).
    IIRC this is possible with a T4.1? Since that's where the idea of using the second port originated. There's probably a good chance he has an SD breakout already.
  • J
    jmarsh replied to the thread Using "SDIO2" for SdFat (SD card).
    The pins aren't used directly, all the programming is done via the USDHC interface which is hardcoded to USDHC1: https://github.com/PaulStoffregen/SdFat/blob/master/src/SdCard/SdioTeensy.h#L231 Some of the clock configuration might need to be...
  • J
    jmarsh replied to the thread Teensy 4.1 PROGMEM remap?.
    PROGMEM is mapped as read-only, it's intended only for const data. If you want to write to flash, you have no choice but to use something like LittleFS where you have to manually perform write operations (due to flash needed to be...
  • J
    jmarsh replied to the thread SPI slave on teensy 4.1.
    Teeny 4.x in slave mode doesn't support generating output data mid-transfer. All data to be sent has to be in the transmit FIFO before the master asserts CS (begins a transfer).
  • J
    jmarsh replied to the thread FlexCAN not compiling.
    From the looks of it that library is not intended for use with Teensy 4.x, it hasn't been touched in over 10 years (well before 4.0 came out).
  • J
    The _SELECT_INPUT settings are not correct for the LPSPI3 pins you are trying to use.
  • J
    float batteryVoltage = (sensorValue * (5 / 1023.00))/0.090909; //0.090909 is (R2/R1+R2) This assumes the reference voltage is 5V, for Teensy 4.x it is 3.3V. Also make sure you have Teensyduino 1.59 or higher installed; earlier versions don't...
  • J
    @PaulStoffregen could you check what's happened to the original thread? (link is in the opening post)
  • J
    Make sure there is something like #include <Arduino.h> at the top of the file to provide the definition of PROGMEM.
  • J
    Are you sure you're applying it to a font that the program is currently using? If the data isn't referenced then it will already be dropped at the linking stage and changing its location won't make any difference.
  • J
    Had a bit of a re-think, this can be done simpler with a logic shifter rather than two state shifters: // Channel A is plugged in FlexIO2:1 pin (Teensy 4.1 pin 12); Channel B in FlexIO2:0 pin (pin 10) CCM_CCGR3 |=...
  • J
    Having a closer look at the code, you should be setting the TIMCTL and SHIFTCTL registers last (after configuring the other registers); setting the operating modes is what activates the timers/shifters and starts them running.
  • J
    It looks like timer1 is out of sync with the incoming data, I would expect it to toggle state at the end of the word rather than the beginning of the next one. What happens if it is set to enable on the trigger rising edge and disable on compare...
  • J
    Yeah that window is likely too small for a Teensy... The pins are only rated for ~200MHz, and using an interrupt is definitely out of the question when instructions take longer than 1ns.
  • J
    It already exists. *(portControlRegister($PIN_NUMBER)) = IOMUXC_PAD_DSE($DRIVE_STRENGTH) | IOMUXC_PAD_SPEED($SPEED); $DRIVE_STRENGTH = a value from 0 to 7. $SPEED = a value from 0 to 3.
  • J
    jmarsh replied to the thread 4 wire fan speed control.
    It's hidden below the bottom of the dialog box, you need to scroll down. Due to windows 11 being stupid, it doesn't show the vertical scroll bar / auto-hides it.
  • J
    Because the transfer "begins" when the CS line goes low. That triggers the ADCs to place their sampled value into their shift registers ready for reading. So every time CS triggers it resets the reading position back to the beginning of the...
  • J
    That won't work because as mentioned in the opening post the ADCs are daisy chained together. A transfer of 18 bits will only receive a value from the ADC at the end (or front, depending on how you look at it) of the chain.
  • J
    jmarsh replied to the thread 4 wire fan speed control.
    Did you set the board type correctly?
  • J
    jmarsh replied to the thread NXP CMSIS FFT on Teensy4?.
    Which butterfly operations, specifically? The arm_radix4_butterfly_q15 function for example, precompiled in libarm_cortexM7lfsp_math.a is full of DSP instructions like SHADD16, QADD16, QSUB16, etc.
  • J
    jmarsh replied to the thread Using Crash Reports.
    Only if the Teensy isn't powered off in-between. The CrashReport data is in volatile memory at the end of RAM2.
  • J
    The TDR and RDR registers are actually FIFOs; words written to TDR are added to the end of the transmission FIFO and words read from RDR are removed from the top of the received FIFO. I believe on the Teensy 4.x, the FIFOs both have a capacity of...
  • J
    jmarsh replied to the thread Using Crash Reports.
    I don't see how this is at all possible. You say the serial port never shows up but from the code you posted, the while (!Serial); line would block until an app connected to the com port. So the code checking CrashReport wouldn't even get...
  • J
    jmarsh replied to the thread External power and USB data.
    Yes, data transfer still works when there's no load on the USB Host's power.
  • J
    jmarsh replied to the thread 4 wire fan speed control.
    Judging by that video the tacho signal is open drain - it has no "high" voltage and requires a pullup. So you could connect it directly to a Teensy pin configured for INPUT_PULLUP mode.
  • J
    That's obviously not the complete code because there's a bunch of functions missing, and I suspect you are initializing the serial link and have a "while (!Serial);" line somewhere...
  • J
    jmarsh replied to the thread Moving to Ubuntu Linux.
    I believe that's because the windows compiler is built using cygwin, which is a library that allows code designed for linux to run on windows by emulating system calls. The resulting binaries run fairly slow due to the emulation overhead.
  • J
    I was replying to the opening post, not your reply. (mutexes are also not suitable for this purpose, since they imply ownership of a resource.)
  • J
    This seems like the wrong way to go about things, if you want a thread to block/sleep make it wait on a semaphore that gets signalled whenever it should resume.
  • J
    Magenta is equal parts red and blue so it would make sense that it appears normal if they are swapped...
  • J
    jmarsh replied to the thread Unix on Teensy 3.5.
    I wouldn't call it "the real-deal" without an MMU, which the Teensy simply isn't capable of.
  • J
    Sounds like a bug in platformio's Teensy linker script.
  • J
    Now hang on a moment... p1 is also a global variable and the ISR is using it to track the current write position? How does that work when loop() is constantly resetting it to the beginning, regardless of whether bufferdone is set or not? This...
  • J
    jmarsh replied to the thread Problem with PSRAM.
    EXTMEM variables can't be statically initialized (to any value except 0).
  • J
    I think that's mainly because it's more flexible (allows any pin to be used as CS) and it's how the regular arduino SPI library was designed. Teensy's SPI library does have a setCS() method to configure a CS pin to be driven by the SPI module -...
  • J
    Which pin are you using for CS? I'm pretty sure it would have to be one of the specific SPI hardware CS pins for this to work, but also I'm not sure if this capability is included in the SPI library.
  • J
    And what is value1? How do we know if it's statically or dynamically allocated, which region of memory it exists in and if it's cacheable? How can we know it's not being overwritten by some code overruning a buffer stored next to it? How do we...
  • J
    You need to post at least enough code so that it can be compiled. We can't see how most of the variables are declared or know what their types are, we can't see where/how bufferdone is being set, we don't know how the value1 array is being...
  • J
    You can write using this method as well (writing is faster than reading because there are no delay cycles required), I just didn't include the code for it in the example. You can't use this method at the same time as FlexSPI access because the...
  • J
    Only like any other SPI device. You have to manually call functions to read and write to it rather than it being memory-mapped.
  • J
    Yes... rewrite it because references don't work the way that code intends them. References can only be "bound" at creation, so static SPIClass& SPIPORT = SPI; mean SPIPORT will always refer to SPI. When the SerialFlashChip::begin() later tries...
  • J
    Sequential reading is much simpler/faster because the address only needs to be sent at the beginning. Then as long as you keep clocking the PSRAM (two instructions) it will keep delivering nibbles from sequential locations. What really piques my...
  • J
    A small note about this: free() will internally check if the argument is NULL so you don't need to explicitly do it beforehand.
Back
Top