![]() Since the value on pin 10 is ignored, providing it is set as an output, then it can also be used as the SS line for your first, or only, slave. ![]() If configured as an output the Arduino ignores the value on that line, and thus the SPI hardware will not be put into slave mode. Pin 10 of the Arduino is the SS line - so does this mean you have to use it for the peripheral SS line? Or should it be kept high? The answer (from the Atmega documentation) is that the SS line (pin 10) must be configured as an output (regardless of what value is on it). Then, and only then, should they configure their MISO line (master in, slave out) to be an output, so they can send data back to the master. Thus, slaves should let each of the lines float (as inputs) unless their slave select is taken low. This way you only need 3 wires (plus ground) in total, plus one slave select for each slave. The way this is done is to tie the SCK, MISO and MISO lines together (for each slave) and have a separate SS (slave select) line for each slave. This is because the SPI hardware can be used to communicate with a number of slaves at once. There is a bit of confusion about the Slave Select pin. ![]() The code to produce this (in Arduino's C++ language) was: Also the slave should ignore any clock pulses now (they may be for a different peripheral). At this stage the slave should release the MISO line (configure it as an input, or "high impedance"). G - SS taken high to indicate end of the sequence of data.F - "No data" after "Fab" - however the SS is still enabled.Also the slave can place data on the MISO line for the master to simultaneously read in. This tells the slave to read the data on the MOSI line. For each of the 8 bits the SCK (clock) line is briefly brought high, and then low again. C - First character arrives (the letter "F" or 0x46 or 0b01000110).The slave can now prepare to notice clock pulses on the SCK line. At this point the slave should prepare to transfer data by setting the MOSI (master out, slave in) line, and the SCK (serial clock) as inputs, and the MISO (master in, slave out) as an output. B - SS taken low to enable the slave (peripheral).I put a trigger on the SS (Slave Select) pin so that the logic analyser would start analysing from when the sequence started.įrom the above graphic note the following points of interest: It shows the 3-character sequence "Fab" being sent from the Arduino. Thanks again.Let's start with an image - this is a screenshot taken with a logic analyser. If you have any questions or something is not making sense please ask am I will try to clear it up. The Pi is still being used because the GPS is integrated to it and it has file write/storage/retrieval capability built-in but if you think PSoC could easily handle the addition of serial GPS data with 100-200 bytes <20Hz and data storage to SD card or something, then I am all ears! Can PSoC be a SPI slave and send all this data (only 32-ish bytes) to Pi?.Can PSoC do the above while monitoring 4 separate interrupts (that WILL inevitable happen at the same time so I don’t want to miss pulses)?.Can PSoC be a master to 4 SPI buses and get data from 4 slaves simultaneously?.I hope I am explaining this in a clear way. To further complicate things I would like this stuff to happen as close to “real time” and simultaneous as possible, meaning I want RF data from each channel at 1000Hz minimum (per channel) while still being able to monitor the interrupts. I am hoping to have PSoC be the Master on 4 SPI buses (talk to 4 separate nRF24 chips and grab 4 bytes of data), monitor 4 Interrupts (and calculate RPM), then send the 4 RF Channel data and 4 RPMs to Raspberry Pi via SPI (Pi is SPI Master and PSoC is SPI Slave). The Base Station is the Section that I am looking to implement PSoC. The Pi has no hard system clock (oscillator or equivalent), the software clock and nature of an OS proves inaccurate for syncing these files.Each of the above are currently NOT synced together. Pi logs each of the above with timestamps to separate.400Hz/channel RPM data read sequentially(meaning Arduino Mega asks each Arduino Micro one after another for their current RPM).~750Hz/channel RF data read sequentially (meaning Base Station RF reads channel 1, then channel 2 then …etc).Pi was the best way I knew how to log to files all the data I am collecting.These Micros are running interrupts for pulse counters to get RPM (1500RPM, 5-10 pulses per rev (I choose this) so 125Hz-250Hz maximum) Mega has 4 Arduino Micros attached talking on I2C.Connected to Arduino Mega via USB (Serial).Arduino Micro connected to nRF24L01+ sending 4 bytes of data.Quick overview of a project that I wanting to convert over to PSoC. ![]() I am very new to PSoC and have yet to even program a board! I am well versed in Arduino-type micros and Raspberry Pi but have quickly reached the ceiling of the Arduino processing power and am hoping PSoC is the answer!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |