Problem with multiple CS-Pins SPI

  • We are currently working on a device with 2 SPI controlled analog outputs.


    We configured one device to use the PicoMOD Pin 126(dez), which should be configured with the value 75(dez), as the CsPin.
    But it seems like the registry value is ignored by the system, and the default CsPin (Pin 1) is used instead.


    Our registry settings for reference:
    Device1:
    Prefix = SPI
    Index = 1
    DLL = nspi.dll
    Order = 101
    FriendlyName = Native SPI driver
    CsPin = 75


    Device2:
    Prefic = SPI
    Index = 2
    DLL = nspi.dll
    Order = 102
    FriendlyName = Native SPI driver


    Please note that we already removed device2 from the registry, for further testing on device1.


    The nspi driver version is 3.1
    The used class is NativeSPI.dll (V2.00) for c#.


    The initialisation of the SPI is done by the software:


    nspi = new NspiPort("SPI1:", NspiPort.NspiAccess.WRITE);
    nspi.ClockFreq = 250000;
    nspi.SpiMode = 0;
    nspi.Method = NspiPort.DriverMethod.POLLING;


    Could you tell us, if there is some error in the registry setting for the SPI device?
    Or are there only specific I/Os that can be used as CsPin?

  • Hello,


    according HW documentation PM7A supports only one CS. The native one, HS SPI has dedicated pins! As you outlined above this CS is pin 1. So at the time it is not possibel to adjust CS at all.


    Nevertheless it is possible to fit the driver for your purpose (several devices) and use any available GPIO as CS, but this needs time and some tests (best on your side). Another possibilty is to toogel GIOs from inside your application - but this is not a really good idea:(.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,


    i will try to provide you a test image/driver within the next two days. It is *not* a real big task to implement it. I would be nice when you do the test then will save some time.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

    Edited once, last by fs-support_ZU ().

  • Hello,


    attached the new driver V3.2. If any problems occur please set "debug" to 0xff and send me serial debug output. Thanks.


    Attachment deleted,please use version below

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

    Edited once, last by fs-support_ZU ().

  • Hello!


    We tried using the new driver, but had only partial success.
    The default CsPin isn't used anymore, but we dont get a "High" signal on the defined pin either.
    The configured CsPin stays on a "Low" signal and doesn't budge. The software receives a timeout error message right after.


    We tried the following CsPin settings: 75, 126, 18, 45 all in dez;
    Which enumberation do we need to use for the configuration? Board Pins(126dez) or the IO-Pins(75)


    The Debug Output:

  • Ok, have to check:(
    Pin 126 refers to IOPin 75 (so 75 is register value to set).

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Ok, new V3.2.


    I test with Pin 29 -> IOPin 9 and Pin 1 -> IOPin 64 (native HS SPI CS).
    Now it should work without problems.

    Files

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Thank you for your fast help!


    We used the new driver and it seems to work without any problems.


    One question though:
    We are able to use the IO-Pin 18 as CS and it works, but I read afterwards that this pin should be read only(specified in the device driver file).
    Is it possible that errors or any other errors occure if we keep on using this pin?

  • Hello,


    ok thanks too, we fix the code from the driver above as V3.2.


    Were did you got the "read only" information from? Document? Documentversion?
    In general on PicoMODx this pin is used as SD/MMC clock - so you can't use this driver anymore. Best would be to swich it off ("Flags=4").
    No more "free" pins like GPIO0-GPIO5 (pin42-46,29)?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • The read only is documented in the currently linked device driver file at the PicoMod7A (24.01.2013). See port description 4.1, Port2 Pin2;


    But can this driver still use the standard CsPin?
    We tested the multi CsPin usage with the default CsPin and the IO-Pin 18 and it seems like the default pin isn't driven.
    Both CsPins are driven correctly if we use 2 IO-Pins.

  • Hello,
    "PicoMod7A (24.01.2013). See port description 4.1, Port2 Pin2;" this was a restriction we remopved by SW. We will update the docs.
    "We tested the multi CsPin usage with the default CsPin and the IO-Pin 18 and it seems like the default pin isn't driven." I have to check again:(.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Ok thanks for this information, found a small initialisation problem, now everything should work as expected. Please test:

    Files

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • The default pin is working now.


    We are going to test the application till next monday, and will post any results then.


    Edit:
    After running some tests with different IOs and a longtime test over the last week it seems like the driver is ok and can be released.


    Thank you for your fast help.