Code Monkey home page Code Monkey logo

tspislave's Issues

Teensy LC/3.2

Hi did you test it with LC?
I am just testing your sketch from the example file.
When I select Teensy 3.6 in IDE 1.8.8 it compiles OK, but for 3.2 and LC I get an error
`C:\Users\Andrej\Documents\teensylc-tspislave-fastled\teensylc-tspislave-fastled.ino:11:29: error: 'SPI2' was not declared in this scope

TSPISlave mySPI = TSPISlave(SPI2, miso, mosi, sck, cs, spimode);

                         ^

Error compiling for board Teensy LC.`

Tried to change the pins and SPI[x] to different values, but no effect.

Andrej

SPI ss polarity and phase

Hi I was wondering if its possible to change the ss polarity and phase using this library. Thanks.

SPI slave response delayed by 1 transfer

First off thank you very much for your work getting the teensy to act as an SPI slave. I'm having a strange issue though and was hoping you would recognize it and have a simple solution.

I have a master Teensy LC sending a few transfers and a Teensy 3.2 slave just sending back a matching response. I believe I understand SPI thoroughly and know responses are expected on the next transfer, but I'm actually getting the responses after 2 transfers. My slave code just responds with the received data and my master code is using the standard SPI library that works with everything else so I'm at a loss.

All I'm doing on the master is:

Serial.Println(SPI.transfer(0xFF), HEX);
Serial.Println(SPI.transfer(0x01), HEX);
Serial.Println(SPI.transfer(0x02), HEX);
Serial.Println(SPI.transfer(0x03), HEX);
Serial.Println(SPI.transfer(0x04), HEX);

but the returned result is:

0x03  // I know the first result will be junk left over from the last sequence, so this is ignored
0x04  // This is where I would expect the 0xFF back from the slave
0xFF  // response arrives 1 byte late as well as subsequent bytes
0x01
0x02

My slave code doesn't differ much from the example, the onReceive function looks like this:

void myFunc()
{
  while (mySPI.active())
  {
    if (mySPI.available())
    {
      uint16_t rx = mySPI.popr();
      mySPI.pushr(rx);
    }
  }
}

From my understanding this code should just reflect any received data back as a response on the next transfer.

The SPImode argument is set to 8 on my slave, setting it to 16 actually makes the response delayed by another 2 bytes so that's not the issue. Thanks in advance for any help you can offer

Teensy 4.0 support

Teensy 4.0 is here -- looks like the library will need some updating to support it. Right now there are compile errors like the following:

TSPISlave.cpp:54:15: error: 'IRQ_SPI0' was not declared in this scope

     spi_irq = IRQ_SPI0;
TSPISlave.cpp: In member function 'bool TSPISlave::setSlaveMISO(uint8_t)':

TSPISlave.cpp:115:38: error: 'PORT_PCR_MUX' was not declared in this scope

     CORE_PIN1_CONFIG = PORT_PCR_MUX(2);
TSPISlave.cpp: In member function 'bool TSPISlave::setSlaveMOSI(uint8_t)':

TSPISlave.cpp:141:24: error: 'PORT_PCR_DSE' was not declared in this scope

     CORE_PIN0_CONFIG = PORT_PCR_DSE | PORT_PCR_MUX(2);

I assume more #ifdefs are required to setup SPI that are specific to the Teensy 4.0 hardware. Not sure how to fix this myself as I don't know the intricacies of configuring this, unfortunately.

Any plans for supporting Teensy 4.0 in the near future?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.