Jump to content
  • 0

Difficulty reconfiguring SPI pins in digital discovery with python


simoncools

Question

When I configure a particular pin as SPI clock I am unable to reconfigure this afterwards to a regular clock signal.

When i try to reconfigure the pin used as clock in SPI into a clock signal with the pattern generator, i get about 10us of clock pulses and then it randomly stops.

If I comment out my SPI code it configures just fine.

Anyone got a clue to what i'm missing here?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @simoncools

The protocols (SPI,I2C..) use the digital-out and digital-in device resources, configuring these with specific output type, clock and/or custom pattern or rom logic, run length...
Before configuring digital-out/in for other purpose call the FDwfDigitalOutReset and/or FDwfDigitalInReset.

Link to comment
Share on other sites

  • 0
25 minutes ago, attila said:

Hi @simoncools

The protocols (SPI,I2C..) use the digital-out and digital-in device resources, configuring these with specific output type, clock and/or custom pattern or rom logic, run length...
Before configuring digital-out/in for other purpose call the FDwfDigitalOutReset and/or FDwfDigitalInReset.

Is there a way to only reset a single pin? I wouldn't want to reset all my other digital outputs as well

Link to comment
Share on other sites

  • 0
16 minutes ago, attila said:

Hi @simoncools

Only by setting each of the channel options (enable,output,type,idle,divider,counter,inits,repetition,data) to the value you want, but the trigger, wait, run, repeat are common for all channels.
It can be more effective if you explain what you want to achieve.

I'm working with a custom IC which has an SPI interface. However, other inputs on this IC are also clocked using the same clock input as the SPI interface

So in short, I need to be able to use this clock pin as an SPI clock and also be able to reconfigure this into a continuous clock without modifying any other digital IO.

 

I'll experiment a bit further with the suggestions you're giving.

Link to comment
Share on other sites

  • 0

Hi @simoncools

I would do it like this:

FDwfDeviceOpen

# the device will only be configured when FDwf###Configure is called
FDwfDeviceAutoConfigureSet(hdwf, 0) 

# SPI transfers
FDwfDigitalSpi...

# override DIO, drive CS,MOSI,CLK...
FDwfDigitalIOOutputEnableSet
FDwfDigitalIOOutputSet
FDwfDigitalIOConfigure

# configure CLK
FDwfDigitalOutReset
FDwfDigitalOut...
FDwfDigitalOutConfigure(hdwf, 0)

# release CLK to be controlled by DigitalOut
FDwfDigitalIO...

# start CLK
FDwfDigitalOutConfigure(hdwf, 1)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...