|
Post by angsanto08 on Aug 3, 2018 11:57:33 GMT
Hi,
For a project, I need to make a testbed (shield) for the ShieldBuddy. I need SPI to control a set of digital potentiometers.
As I need to place the digipots on the shield, I had wanted to use the SPI channels 1 or 2 (p12,11,13 or p50,51,52 - MOSI) instead of the P201.
I checked the manual, and I couldn't make it seem to work. (SPI.begin(BOARD_SPI_SS0_S1) etc.).
I was wondering if there is an example code how to use channels 1 or 2.
*I also tried looking in the Variant.h (C:\Program Files (x86)\Arduino\hardware\aurduino_Dx\aurix\variants\tc275) to find any clues if there are other pins that I need to declare to change the MOSI, MISO and SCK pins.
**I also tried setting the SPI pins, but Shieldbuddy's SPI library doesn't support the SPI.setMISO etc. to assign the SPI pins unlike the teensy.
***The Shieldbuddy's Spi ICSP P201 doesn't seem to be physically connected to the other pins (11,12,13,50,51, or 52) like the mega or uno.
Thank you.
|
|
|
Post by Admin on Aug 3, 2018 14:09:13 GMT
Please make sure that you state which pin is to be used as the chipselect when you use Spi.transfer e.g. Spi.transfer(BOARD_SPI_SS0_S1, data).
|
|
|
Post by vinicius on Aug 5, 2018 0:33:40 GMT
Hi,
Is the Spi.transfer16 functions implemented to send 16bits instead of 8bits?
|
|
|
Post by Admin on Aug 5, 2018 7:48:53 GMT
The spi driver is 8-bit like the normal Arduino.
|
|
|
Post by Admin on Aug 5, 2018 7:50:05 GMT
16 bit transfers are possible but you have to use the underlying Infineon iLLD functions
|
|
|
Post by angsanto08 on Aug 6, 2018 2:50:37 GMT
Thank you Admin. It enabled the SPI Channel 1, but I can't seem to make the digital potentiometer work in channel 1. I have the digipot wired to both P201 and channel 1 and just changed the channel. I am not sure what the real problem is. If it is the MOSI or the CS or something else that is different between the channels. My suspicion is that whenever I call the SPI.transfer(BOARD_SPI_SS0_S1, cmd) then SPI.transfer(BOARD_SPI_SS0_S1, data), it toggles the CS in between. Is there a way for it to not toggle the CS, or would I need to use the 16-bit (SPI.transfer16). If so, where can I get references on how to use that. I have attached pics of the oscilloscope (yellow-CS, blue-SCK, violet-MOSI,green-digipot). The first image is using P201, while the second one is channel 1. Thank you.  
|
|
|
Post by angsanto08 on Aug 6, 2018 4:53:49 GMT
Thank you. I figured it out. I just used a different CS pin (manual toggle) for the actual control.
|
|
|
Post by vinicius on Aug 7, 2018 9:01:41 GMT
Hi,
Quick question, how do I change SPI mode?
This does not work: SPISettings(SPIFREQU, MSBFIRST, SPI_MODE3);
Also tried SPI.setDataMode(BOARD_SPI_SS0_S1,SPI_MODE3);
Best.
|
|
|
Post by klabba on Aug 9, 2018 13:10:54 GMT
Hi, I have a problem similar to that of angsanto08. My shield has two SPI devices. Both devices are using the SPI Channel 1 at pins 11, 12 and 13. One device is connected to CS pin 10 and one is connected to CS pin 4. Now I am looking for a possibility to communicate with the CS pin 4 device without addressing the CS pin 10 device at the same time. Is there a way to prevent the automatic switching of CS pin 10 while using a different manually switched CS pin?
|
|