Pages: 1 2 [3] 4 5 ... 9   Go Down
Author Topic: Teensy 3.0  (Read 33386 times)
0 Members and 1 Guest are viewing this topic.
SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6651
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Well lets just not tell them
They caught on anyway.  New policies prohibit "rewards" that are multiples of the product.

That's a shame, because a lot of the need for funding in electronics projects comes from the "scaling up" of manufacturing to larger quantities...  (to build 2 of something small, I get my PCBs from dorkbotpbx, my parts from sparkfun, and use my trusty soldering iron.  For 20, I (might) get the PCBs from itead or Seeed, parts from digikey, and start looking into stencils and hotplates.  For 2000 ... I have no idea, but I'm pretty sure the up-front costs would be pretty significant.

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17262
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Well lets just not tell them
They caught on anyway.  New policies prohibit "rewards" that are multiples of the product.

That's a shame, because a lot of the need for funding in electronics projects comes from the "scaling up" of manufacturing to larger quantities...  (to build 2 of something small, I get my PCBs from dorkbotpbx, my parts from sparkfun, and use my trusty soldering iron.  For 20, I (might) get the PCBs from itead or Seeed, parts from digikey, and start looking into stencils and hotplates.  For 2000 ... I have no idea, but I'm pretty sure the up-front costs would be pretty significant.



Yes, I can see where some start-up capital is really needed to get going. Even then I don't know if the profit margin from the first batch would be high enough to finance the next large batch? The Kickstarter idea was pretty unique and maybe it will still be somewhat useful but it's too bad that a few bad apples have made them be more restrictive in their policy/rules. I recall in the 70s when the micro revolution was just getting started, many start ups would just go ahead and announce the price and avaliblity of a product and accept orders with no product yet to ship, Using the funds from orders to finance the production. It was given the name of  'vaporware' and many a buyer had horror stories about not getting any product ever and no return on money sent, etc.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Those new rules seem to have stirred the hornet's nest.

No way I'm going to read all the comments but the gist of it seems to be that people are angry about the "multiple rewards" and "rendering" bits.

I get why they have done it but it seems we have an example here of the law of unintended consequences, if you have a small and cheap item how are you supposed to reward a $500 pledge?

The rendering is not as clear cut IMO, I know all too well how easy it is to knock up a flash-looking render and some blurb but have nothing of substance behind it (heck that's what I do smiley). But as someone pointed out we are visual beings, we want to see a picture and without that we are unlikely to pledge. I know I never buy anything off the web unless there's a good photo or two of the item.

Fortunately this has no affect on me because Kickstarter is not available to non-US citizens smiley-sad

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
God Member
*****
Karma: 32
Posts: 828
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

New policies prohibit "rewards" that are multiples of the product.

Does that mean a backer can't pledge more than once? E.g., if I'm a backer, and pledge $20 (or whatever) and get one widget as my reward, does that mean I can't later pledge another $20 (and get another widget as a reward for the second pledge?)

I was surprised to read this because I was under the impression many current projects are/were still offering multiples as rewards.

I agree that idea that scale matters considerably in bring per unit price down (and thereby making a product commercially viable or not) is a crucial barrier in production of electronics. Seems to fit with the original kickstarter "mission" very well. Maybe there will eventually be an exception made for electronics?
  
« Last Edit: October 08, 2012, 08:45:24 am by pico » Logged

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Offline Offline
God Member
*****
Karma: 32
Posts: 828
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have this Maple version of SdFat http://code.google.com/p/maple-sdfat/ and it doesn't use DMA.

Oops! Well, that's embarrassing. I was under the assumptions a) that the Maple port used DMA, and b) that someone else besides yourself had done the port! smiley-red

I have examples of Kinesis SPI DMA and plan to try it but it won't help much.

SD, DMA, and SPI don't work too well together.  The problem is the SD SPI protocol.  SD cards indicate busy in SPI mode by holding MISO high so you can't just setup a DMA transfer and go away.  The protocol uses control tokens in the data stream which is a pain.

Oh well, at least I've learned something. Anyway, thanks for your continuing support on both these fronts!

« Last Edit: October 07, 2012, 09:32:52 am by pico » Logged

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

  Look here for DMA mod of Maple: https://github.com/polpla/Maple-SDFat-DMA

Discussion: http://forums.leaflabs.com/topic.php?id=112&page=8

Related: https://github.com/leaflabs/libmaple/blob/master/libmaple/stm32f1/dma.c#L261
« Last Edit: October 07, 2012, 04:35:36 am by cyclegadget » Logged


0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maple-DMA is not very interesting.  It polls using single byte SPI reads while the card is busy then sets up DMA and polls while DMA runs. This does not save any CPU cycles or reduce the write latency.  In fact there is a huge amount of unnecessary code due to the fact that this is an old version of SdFat.

Using the Freescale Kinetis SPI fifo should be as fast or faster.  A loop to deliver 3 MB/sec to the SPI fifo for 24 MHz SPI should be easy with the Freescale Kinetis.

Improving use of cache and multi-block SD commands will produce a much larger gain than DMA.  I can already get about twice the performance of the Maple-DMA version of SdFat on a AVR Mega with these improvements.  I hope to get about another factor of three on Kinetis.

DMA could be useful with a multi-threaded RTOS.  You could then build a true driver thread with the driver sleeping while DMA ran.

I plan to port ChibiOS and FreeRTOS to Cortex boards.  ChibiOS and FreeRTOS already runs on Maple.  I plan to integrate the RTOS kernels as a library so you can use the IDE core functions and other libraries in multi-thread mode.

Unfortunately my Teensy 3.0 seems lost in the mail so I can't start testing.  I ordered two more from Adafruit so something should arrive soon.  
« Last Edit: October 07, 2012, 08:13:27 am by fat16lib » Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 Thank you for the explanation!
Logged


0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul has now provided SD access for Teensy 3.0 in his beta 4 release. 

This is done by very clever emulation of the AVR SPI registers.  There is also an emulation of AVR PORT and PIN registers.

Look at arduino-1.0.1/hardware/teensy/cores/teensy3/avr_emulation.h to see how this is done with C++ classes.
Logged

0
Offline Offline
God Member
*****
Karma: 25
Posts: 606
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

LOL, I'm just now seeing this thread.... been far too busy shipping the rewards and writing software!

I was wondering if anyone would ever notice those C++ classes?!  I did some looking at libraries that use SPI, and sadly most of them directly access the AVR registers.  The official SPI library arrived relatively late in the development of Arduino, so it hasn't been widely adopted.  It also changed its own API at least once, causing at least one library author to dump it and go directly to the registers.  The existing SPI library isn't much of an abstraction (eg, able to support the fifo, dma, or automatic chip select signals).  Fortunately, the compiler optimizes away pretty much all of the C++ stuff because it's inline functions.  The SPCR part isn't highly efficient, but the data register and status flag compile to the equivalent registers accesses.  It was pretty painful having to clear the fifo every time SPDR is written, but that's necessary to faithfully emulate the AVR registers.....

For your sdfat library, at least making good use of the fifo should be much faster.  Would you prefer to put the Freescale registers directly into your sdfat library, or work with the a new SPI library that supports the fifos and other features (and might be adaptable to other new chips with similar SPI features)?
« Last Edit: October 08, 2012, 08:25:33 am by Paul Stoffregen » Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul, I am doing a major redesign of SdFat to use better caching and faster SD commands so large writes/reads will be much faster.

I plan to support SPI and 4-bit SDIO on various Cortex M chips.  I also want to make SdFat RTOS friendly when using DMA.

I would love to have a better low level SPI library for each chip.

I need a way to restore the SPI speed and mode each time I access the SD.  I need single byte read and write for sending commands, receiving status, and polling for busy.

I need fast block read and write routines.  These could use a fifo or DMA.

I am ready to start testing with some prototype SPI functions I have done but for some reason my Teensy 3.0 has not arrived in California yet.

Edit:  I need the equivalent of these AVR functions.
Code:
//------------------------------------------------------------------------------
/**
 * Initialize hardware SPI
 * Set SCK rate to F_CPU/pow(2, 1 + spiRate) for spiRate [0,6]
 */
static void spiInit(uint8_t spiRate) {
  // See avr processor documentation
  SPCR = (1 << SPE) | (1 << MSTR) | (spiRate >> 1);
  SPSR = spiRate & 1 || spiRate == 6 ? 0 : 1 << SPI2X;
}
//------------------------------------------------------------------------------
/** SPI receive a byte */
static uint8_t spiRec() {
  SPDR = 0XFF;
  while (!(SPSR & (1 << SPIF)));
  return SPDR;
}
//------------------------------------------------------------------------------
/** SPI read data - only one call so force inline */
static inline __attribute__((always_inline))
  void spiRead(uint8_t* buf, uint16_t nbyte) {
  if (nbyte-- == 0) return;
  SPDR = 0XFF;
  for (uint16_t i = 0; i < nbyte; i++) {
    while (!(SPSR & (1 << SPIF)));
    uint8_t b = SPDR;
    SPDR = 0XFF;
    buf[i] = b;
  }
  while (!(SPSR & (1 << SPIF)));
  buf[nbyte] = SPDR;
}
//------------------------------------------------------------------------------
/** SPI send a byte */
static void spiSend(uint8_t b) {
  SPDR = b;
  while (!(SPSR & (1 << SPIF)));
}
//------------------------------------------------------------------------------
/** SPI send block - only one call so force inline */
static inline __attribute__((always_inline))
  void spiSendBlock(uint8_t token, const uint8_t* buf) {
  SPDR = token;
  for (uint16_t i = 0; i < 512; i++) {
    uint8_t b = buf[i];
    while (!(SPSR & (1 << SPIF)));
    SPDR = b;
  }
  while (!(SPSR & (1 << SPIF)));
}
« Last Edit: October 08, 2012, 09:04:34 am by fat16lib » Logged

0
Offline Offline
God Member
*****
Karma: 25
Posts: 606
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Edit:  I need the equivalent of these AVR functions.

I can do those, using the fifo for good speed.

Is there a version of your library which already uses these?  Or some test code that calls them to do something simple, like read and print the MBR or Volume ID sector?

I need some sort of test code that I can compile and run.
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This beta of SdFat uses the above functions: SdFatBeta20120825.zip http://code.google.com/p/beta-lib/downloads/list.

The functions are at the top of Sd2Card.cpp

It also has the following function to initialize AVR SPI pins:
Code:
/**
 * initialize SPI pins
 */
static void spiBegin() {
  pinMode(MISO, INPUT);
  pinMode(MOSI, OUTPUT);
  pinMode(SCK, OUTPUT);
  // SS must be in output mode even it is not chip select
  pinMode(SS, OUTPUT);
  // set SS high - may be chip select for another SPI device
#if SET_SPI_SS_HIGH
  digitalWrite(SS, HIGH);
#endif  // SET_SPI_SS_HIGH
}

This version of SdFat does not have the new stuff to speed up large reads and writes.  That involves changes to use multi-block SD commands.
Logged

0
Offline Offline
God Member
*****
Karma: 25
Posts: 606
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm looking that the beta code now....

One minor but important point for compiling on 32 bit platforms is the use of packed structs.  By default, the compiler will align 32 bit types to 4 byte boundaries on 32 bit processors.  That's definitely not what you want in SdFatStructs.h.  It's necessary to add "__attribute__((packed))" to each struct definition, so the compiler packs the struct as intended.

For example.

Code:
struct masterBootRecord {
           /** Code Area for master boot program. */
  uint8_t  codeArea[440];
           /** Optional Windows NT disk signature. May contain boot code. */
  uint32_t diskSignature;
           /** Usually zero but may be more boot code. */
  uint16_t usuallyZero;
           /** Partition tables. */
  part_t   part[4];
           /** First MBR signature byte. Must be 0X55 */
  uint8_t  mbrSig0;
           /** Second MBR signature byte. Must be 0XAA */
  uint8_t  mbrSig1;
} __attribute__((packed));
Logged

0
Offline Offline
God Member
*****
Karma: 25
Posts: 606
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The 32 bit compiler does not like many things in your iostream headers.  :-(

I'll work on this more later today or tomorrow.  For now, I need to focus on getting the rest of the kickstarter rewards shipped.
Logged

Pages: 1 2 [3] 4 5 ... 9   Go Up
Jump to: