Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 28 of 28

Thread: Teensy 3.1 - Correct way to use interrupts on received Serial data

  1. #26
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,426
    Best is to write to SD 512Byte packets (or a multiple of 512) - that's the internal storage block size for SD Cards. Any other size will be slower.

  2. #27
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,052
    Quote Originally Posted by s_arty View Post
    I would have programmed from scratch using PIT0 from kinetis documentation. (could not find intervaltimer on my TD installation, so I cannot confirm if this is OK for T3.x) Unfortunately the PJRC website examples is full of Teensy2 examples.

  3. #28
    Junior Member
    Join Date
    Dec 2018
    Posts
    9
    Thank you for your suggestions!!!
    When you say, I need to write 512 bytes packets, do you mean sd unit size?
    Click image for larger version. 

Name:	Capture.PNG 
Views:	8 
Size:	8.2 KB 
ID:	15496
    in my case it's 32 Kbytes

    I'm using SD.h to write file, is there a proper way to write data blocks?
    my example is:
    Code:
    ...
        static Queue  queue1(sizeof(int), 50000); // Instantiate queue
        static const int SD_CLASTER_SIZE = 512;
    
        while((!queue1.isEmpty()) && (queue1.getCount() > SD_CLASTER_SIZE)){
          queue1.pop(&incoming);
          rawFile.write(incoming);
        }
        rawFile.flush();
        
    ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •