This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28M35(TMDXDOCKH52C1): Problem connecting Photo spectrometer via SPI

Other Parts Discussed in Thread: CONTROLSUITE, ADS8341

Hi everyone,

I'm a student at a Université of Grenoble, and i do an internship on a F28M35x (F28M35H52C1).

For the moment, i need to connect a 8-wires cable on the controlCARD of my F28M35x microcontroller, but i don't know how.

Indeed this cable is linking with a spectrometer which use a CMOS actuator to take informations, and these informations need to be analyzed on this electronic card.

I thought put all of these wires out of the cable to put them one by one on the controlCARD pins, but i'm afraid it doesn't work.

Can you recommend me suggestions to make a go of this ?

I put you the cable and the card near it if you don't really understand me (and my poor english, so sorry for that)

Regards,

Sébastien.

  • Hello Sébastien!

    Sorry for the stupid question. What cable do you mean (JTAG, Ethernet or something else)? Which device you connect the cable on the other side? It is hard to understand something from your description and your image. The important thing is not the number of wires but their appointment. Explaine please.

    Regards,

    Igor

  • Indeed i explain you the chain i'm working on :

    with the F28M35x microcontoller, i need to activate a flash ; this flash is the source ( white light ) which go through a gas sample, and the spectrometer associated with the CMOS actuator gives us the "transmittance" of the light after he goes through this sample and normally it gives us which gas composes the sample.

    ...AND the cable i'm talking about is going to carry data, so make the data transfer between a little electronic card situated on the system "spectrometer + CMOS actuator" (which is a sort of "black box" for me) and the F28M35x controlCARD. So i want to control this link between them.

    ...AND i need to do this with this cable, which has been customized by the company where i am.

    It's like a USB or RS 232 cable about its function.

    I give you just below the scheme of their appointment :

    1. this first scheme is the part of this connector which is on "the spectrometer part"

    2. this second scheme is the part of this connector which is on "the controlCARD part"

    Regards,

    Sébastien.

  • Hi!

    Well, now I see that your interface is something like SPI (at least it is written). But at the your image 2 there are 6 connections only. Obviously the connection should be as follows:

    SCLK - SCLK, DIN - DIN, DOUT-DOUT, CLK-CLK, ST-ST, CE-CE

    (The right-hand side of the figure is not relevant to you)

    ATTENTION! I have doubts about the seventh contact - ground. At least it is not present at connector (your image 2). But perhaps you should use the connection of ground also, if bouth your connected devices haven't common ground. But here you must be careful. It would be better if the grounds will be connected via resistor ~120 Ohm.

    Regards,

    Igor

  • Firstly, thanks for you answer, i'm going to read and understand all of this this week.

    Moreover, concerning the cable which going to control the flash, i have a cable with 3 wires : a white, a red and a black wires which are going to be respectively the wire for the command : i must put it on a controlCARD pin, and send a signal on this pin to send this command and activate this flash ; the red which "powers" the flash, and the black wire which is the ground.

    But i test the wires and the flash functions with a minimum voltage of 6V, and at first of view my controlCARD doesn't give more than 5V, no ? what do you think about ?

    Regards,

    Sébastien.

  • Hello Sébastien!

    1 If you have problems with the translation, we can go to the French. But if you are using Google Chrome then you should not have such problems.

    2 If your controlCARD based on F28M35 have power supply 5 V then it does not mean that you will get 5 V from GPIO-pin. You will get 3.3V only (refer to 8510.TI_f28m35h20b_overview.pdf page 112).

    3 Try to test your flash function scheme at 3V. Maybe it will work. If your scheme will not work then you should raise the level of GPIO-pin. The best way is to apply electrical galvanic isolation (based on opto-coupler diodes) for your control circuits and GPIO-pins of controlCARD. For opto-coupler diodes you should use another DC-power supply wich provides required level (6V or higher). 

    It is all now...

    Regards,

    Igor 

  • Hi Igor,

    Je préfère parler anglais, ça me permet d'autant plus d'améliorer mon "pauvre" anglais. Mais s'il y a des termes que je n'arrive pas à traduire je le mettrai en français, merci !

    Well i'm going to see this attentively this week and i'm going to keep you informed ?

    Moreover, about the controlCARD, i saw there are 5V-pins next to the GPIO-pins, so can i use them ? about that i thought it was necessary to power the card directly by the dock station ( usb or the external power ), and not by the "main board", is it ?

    Regards,

    Sébastien.

  • Salut!

    Eh bien.

    I think your 5V-pin is input of extern power supply source for controlCARD. But your controlCARD already must have power supply from main board (at least it may be assumed by your image 1). Try to measure voltage on your 5V-pin of controlCARD relatively the ground of controlCARD. For sure you will get +5VDC. By the way I would recommend you to use galvanic isolation not only for flash control chain but also for your SPI-interface. But here the main things is correct choise of added DC-power supply source for optocoupler diodes. This source must provide required levels for SPI. But it's just the thought of how I would have solved your task. It is not imperative at any way!

    Avec respect,

    Igor

  • Hi Igor,

    Well can i keep you informed of the follow-up of this on monday ?

    ps : most of the time in france we say "cordialement" at the place of "avec respect" ;-)

    Regards,

    Sébastien.

  • Salut!

    Bien sûr.

    Cordialement,

    Igor

  • sebastien begue said:

    1. this first scheme is the part of this connector which is on "the spectrometer part"

     Hi Sebastien, sorry for accesnt but I am not able to write in french with my keyboard, to solve your problem more information need to be seen, at first, do you have some specs of Photo spectrometer and command description too?

     On concerto part software that try communicate is ok? SPI has some different working mode is the one selected the same as spectrometer interface?

     3.3V is over half 5V so interface can still work but need input pin be 5V compliant otherwise the chip involved in communication can burn out or damage his input too.

     Again when you receive data back from spectrometer you need analyze too, why a so complex and expensive board like concerto?

     

  • For Igor Gorbachev :

    0. Firstly, is it possible to connect my white pin (the "command") on an ADC pin and send an ePWM signal to activate my flash, or just GPIO pins can work ? ( sorry for the stupid question ! )
    1. I connected the white wire to a pin, the red wire to an external generator which powers the "flash block" and the black wire to the ground ( and i connect together the ground of the external generator and the controlCARD ground );
         After that i sent an ePWM signal on the pin where i put the white wire, and the flash doesn't switch on, so i think with 3.3V that doesn't work.
    2. I try to test the "flash block" with a power of 3V and it doesn't work too.
    3.  After, i've got just one external DC-power, and it is ever used to power the flash block, but like i said you my flash block can power with 6V, so i can put 6V everywhere ?
    4. ...But for that i need to opto-coupler diodes, and :
       you said one way is to use opto-coupler diodes between control circuits and GPIO-pins of controlCARD, what do you mean with "control circuits" ? I've never made a     galvanic isolation.
         Indeed i'm in a start-up enterprise, so they don't have many materials, also no opto-coupler diodes... is there another solution ? ( My solution to power the dock station plugged into the mains supply ( with a block which give 6V at its output ) don't ensure this appropriate 6V ? ( maybe it's just another way to power my controlCARD... )
       -> SO if there is no another solution, do you think you can give me  a good reference of opto-coupler diodes to make this order ? ( and multimeter too i think... )
           If you haven't got this time, just give me a link where i can find them please.
    5. i can't measure the voltage level of each pins because this enterprise have not multimeter ( and that is very binding ).
    6. after come back on my "SPI-interface" i think it will be good to


    For Roberto Romano :

    1. Indeed i'm at this enterprise since 1 month, and i know they made their own electronic card based on this type of processor, but it has not arrived yet, so they decided to buy an electronic card with the same processor to develop code on it.
        I suppose they choose this so complex and expensive board because in few months we are going to make real-time measurement on online analyzers, put relays on it, many actuators, and a communication with many materials like global communication center are going to be activate at the same moment.
    2. About the command, you mean the command of the flash block ? if it's that, just a "6V square signal" is enough to activate this flash.
    3. When you ask me if i have photo spectrometer specs, do you think about the optical part or the electrical part ? because indeed in the spectrometer they integered a CMOS actuator, and at the output we have a little electronic card which allows the informations sending by "serial way" : the reference is AD8341; i give in few moments the scheme associated.



    Thanks for your attention,

    Best regards,

    Sébastien.

  • Hello!

    0 I think you need to use GPIO.

    1-2 You have tested your "flash block" with 6V and if I understood you right your "flash block" have worked correctly. Thus you should increase GPIO-level to 6V.

    3 If you connect together the ground of the external generator and the controlCARD ground, in this case the reason of using galvanic isolation disappears. This reason also disappears if you use only one common DC-power supply. About "control circuits" I mean your chain "withe wire - GPIO".

    4 I would prefer to use galvanic isolation of your "flash block" and controlCARD. At this case you need added  DC-power supply source (for "flash block" and opto-coupler diode). The ground of  "flash block" (with your external generator + added DC-power supply source) and gound of controlCARD(+first DC-power supply source) you need to separate.

    if you don't want to use galvanic isolation and added DC-power supply source you can use one added external transistor (in shift mode scheme) for the increasing of GPIO-level. But on my opinion it is less reliable solution.

    5 You can buy simple inexpensive multimeter for your measurements. Without a multimeter work is going blind.

    Regards,

    Igor

    P.S. I would recommend you to rename your post. For example: F28M35: Problem connecting Photo spectrometer via SPI

  • Hello Igor,

    a. Sorry for my incomprehension, but what is "shift mode scheme" ? 

    b. I think for a first brief test, it's better to buy and use an external transistor to ensure this 6V, because if i choose to separate each ground and have a galvanic isolation, i need to buy opto-coupler diodes and another external DC-power, and it's going to take a long time, isn't it ?

    ...AND if i use this external transistor can i put it on the dock station or an external support ?...so the GPIO-pin signal will pass through the external transistor before going to the flash block ?

    c. Concerning my .b point, the problem is that it's going to be difficult to have another DC-power because the system i am working on need to be portable ( it's an online analyzer )...

    d. maybe there is a possibility to decrease the power which flash block need to be activate...

    e. and i thought to a solution : can't we take 2 GPIO-pins and put them together, so create a 6.6V ? ( put them in "serial" like a basic circuit ).

  • Hello!

    a. Oh, pardon moi, s'il vous plait ! Transistor in the switching mode.

    b. Ok! Your GPIO-output you should connect to base of a transistor. 

    d. I don't know. You must know better about abilities of your block.

    e. In no case! GPIO-pins are not batteries.

    Regards,

    Igor

  • Hi !

    a.b. Well i took the transistor 2N2222A, and i think i'm going to send an ePWM signal on which i order the duty cycle and that's going to change the voltage of the output, isn't it ?

    d.e. thanks for your answer and sorry for my stupid questions !

    After i bought a digital multimeter FLUKE to ensure the faisability of my system.

    ...and during i'm waiting the receiving of my order i think i'm going to work again on the SPI communication by ordering the flash directly with the external DC-power.

    Regards,

    Sébastien.

  • Or sorry i forgot send the picture like i said before, so this is it just below :

  • Or sorry i forgot send the picture like i said before, so this is it just below :

  • Salut Sebastien!

    Please report your results.

    Good luck,

    Igor

  • this is the scheme like we were talking about

  • which results are you talking about ? is it normal i have 2 posts, one just with few children posts and one with all of them.

    Regards,

    Sébastien.

  • i send another message, i don't know if you receive it ? (below)

    "

    Hi !

    a.b. Well i took the transistor 2N2222A, and i think i'm going to send an ePWM signal on which i order the duty cycle and that's going to change the voltage of the output, isn't it ?

    d.e. thanks for your answer and sorry for my stupid questions !

    After i bought a digital multimeter FLUKE to ensure the faisability of my system.

    ...and during i'm waiting the receiving of my order i think i'm going to work again on the SPI communication by ordering the flash directly with the external DC-power.

    Regards,

    Sébastien.

    "

    that was yesterday.

  • Salut!

    I mean your future results. Don't worry, you will achieve success. The Germans say: "ALLER ANFANG IST SCHWERE". If you will have questions, please contact.

    Goog luck!

    Igor

  • Salut!

    By the way remember that the transistor inverts the signal of base if you take the output signal from the collector (at this scheme the collector circuit includs resistor connected with DC-supply and an emitter connected to ground). Keep that in mind when forming the output signal at GPIO-pin.

    Regards,

    Igor

  • Hi everyone !

    About you Igor, sorry for my later answer, i had many others priorities since we talked ( like the treatment part based on theoricals values ) : about the transistor and the "3.3V -> 6V" process, i'm going to have it tomorrow, i think and i hope.

    Moreover, where do you think i can connect my "SPI cable" on my dock station ?

    ...AND do you think i can separate each wires to connect them on my card, or it has its own place ever reserved ?

    ...because i think i need to synchronize each wire together, so it's important they are connected together at a specific place, no ? sorry, but i never used SPI before, juste usb and RS-232...

    Thanks for your patience to read me and for your answers !

    Regards,

    Sébastien.

  • Moreover, after these questions just above, i have another one : refered to the Technical Reference Manual, when information arrive on SPI, where does the informations go, on SPIDAT  regs or on FIFO regs ?

    ...AND how to know who is the master, and who is the slave please ?

    Regards,

    Sébastien.

  • Dear Sébastien!

    First you need study the basic principles of SPI at least (you do not need delve very deeply, but try to find information in French to make it easier). Also you need read manual F28M35 5700.TI_F28M35x_manual.pdf (about SPI-unit refer from page 1093 etc.). So...In general variant SPI can be used for data transfer connection between one master-device(MCU) and one or several slave-device. In your case there is one master and one slave only. Master produces SCLK-signal. This signal is used by slave for gating each data bit which slave transmits to master...I think it makes no sense to retell the technical documentation. About your phisic SPI-connection with docking station I can't say somethig useful, because I don't know the technical documentation of your KIT.

    Regards,

    Igor

  • So... By the way, add the name of your KIT in the post name 

    F28M35 (TMDXDOCKH52C1) : Problem connecting Photo spectrometer via SPI

    Regards,

    Igor

     

  • "dear sebastien" sounds like "poor sebastien" , but i'm all right with that !

    Well do you know what all the "hole" connectors like female connectors serve ? can i use them ? i don't find informations about them on the technical reference manual.

    Regards,

    Sébastien.

  • Well...I mean "mon cher collègue Sébastien".

    Sorry! I didn't understand you right. What do you mean: "connectors like female connectors serve". Maybe you have the image of this.

    Regards,

    Igor

  • Yes Igor, i was joking !

    indeed i want to know if, after  have removed the small end-piece black, use this ( just below ) to make connection ? and how use them ( if i can of course, because maybe they have another function ).

    Otherwise i use the gpio-pins associated with the respectives simo, somi, clk  like they are defined on the technical reference manual ( page 379 ).

    Regards,

    Sébastien.

  • Hi!

    Does your docking station has some SPI-connector? If it has not it  then you need to use controlCARD GPIO-pins wich is associated with SPI. You read about  the technical reference manual ( page 379 ). Can you send me this manual? I would like to look it.

    Regards,

    Igor

  • Hi !

    this is it :

    1057.TRM.pdf

    No there isn't SPI-connector on my card. I give you too a documentation about the connectors i have that someone gave me on this forum :

    6318.F28M35xx_InfoSheet_06_13_12.pdf

    Regards,

    Sébastien.

  • Moreover, i saw it exists many functions like spi_read(), ... but do they exist for F28M35x ?

    Regards,

    Sébastien.

  •  Hi Sébastien, before to post I read all you wrote, I understand the choice of Concerto, you are not connecting to a spectrometer but need implement a spectrometer software, from your writing I grasped you are still a beginner on both electronics and Concerto too, this is a big hassle and need a long time to solve. So forget my first request about command you don't have a smart spectrophotometer but the electronic pf from where you need do all job.

     On COncerto part you must identify SPI (see on page 6 near right bottom blue signals) interface pin on connector and route them to cable where video adc is wired, on the other side photoflash emitter need to be carefully separated and screened from video part to avoid interference from high EMC radiated from. To do so separate ground and connect to earth with an RC parallel coupling, use an optocoupler or better an ISO interface that is more fast and secure.

     From video I don't know more about the ADC device and resolution you need and or chroma extraction you planned to. Again the choice of this platform and your need to use an EPWM seem to me a fine resolution tuning of something on light emitter, the video detector appear as a single chromatic part, how is tuning performed on?

     So you need develop all code to do spectrophotometry on your own, this can be a very long task.

     Start study example reading an SPI device, grasp how to configure and read write from SPI devices then start read signal from video, again start another parallel task on how to do from tcpip and learn how to trigger flash and get back reading on web, this can simplify your test bed, wen you learned this one you can do work on spectrophotometry theory and implement very complex software on your powerful platform.

     Start from library user guide than datasheet.

     As it wrote your friend: "ALLER ANFANG IST SCHWERE" I can figure sound as first step is difficult then all become simple and you can run by yourself ;)

  • sebastien begue said:

    Or sorry i forgot send the picture like i said before, so this is it just below :

      From this sketch if you need more help on SPI setup correct schematic part number must be in place, this device report an useless function for where in, from analog site:

    AD8341:  RF Vector Modulator 1.5 GHz TO 2.4 GHz

      so this is not a digital RF transmitter and an IQ modulator has no mean to be there.

     About right part seem also a DA or another SPI device is in place, ISO part are recommended to be inserted and power rails properly decoupled too.

  • sebastien begue said:
    functions like spi_read()

    check library for this device on this page

    and download also this software

     From both DSP/BIOS where you can find all you need to analyze your data and SYS/BIOS from where you can search example and function you need you can manage your interface and communicate to web simply and painless ;)

  • Hi Roberto ! Hi everyone !

    First of all thank you for you great attention, and i'm going to work hard to succeed this project, even if i hope i will exceed this first step, like Igor said, quicklier.
    Well i'm going to answer you, Roberto, step by step :



    **** FIRST ARTICLE ****

    1. what do you want to say with  "spectrometer software" ?

    2. you wrote "electronic pf" : is it a mistake ?

    3. the "spectrometer block" is ever composed by a CMOS actuator on it, with an ADC integrated, so that's why i said i go through GPIO-pins and not ADC-pins ; that's wrong ?

    4. What is an ISO interface ? even if i think this enterprise can't buy again others products ( i think yes for an otpocoupler ), that could really be prospects.

    5. I know this spectrometer software allows us the choice of the resolution, and it's for this enterprise it's a goal to have a good resolution, but at first i think to operate the dialog between the 2 cards, and after if we need i could make another sampling, by a C code for example, what do you think about this ?

    6. i didn't understand your question "how is tuning performed on ?" ?

    7. After you think about video but normally i recept frames of data which correspond to the transmission spectrum after the light cross the sample.
       Maybe you're right ; i say that especially because before starting the "hardware" part i made C code lonely on my computer based on theorical absorption values, and made many treatments like the Least Square method,...
       Maybe i don't understand when you said "video" ?

    8. About my C code's part, i will need to implement it on the processor : do you think it's enough to use just M3 ?

    9. Concerning my learning about SPI, i'm in a start-up so there isn't another SPI device with what i could practise... just the spi_loopback given on the controlSUITE.

    10. In all of cases i'm going to practise on all types of SPI exercises, but why tcpip exercises are usefull fin my case where i just have one master and one slave ?

    11. to trigger flash we just need a pulse at a 6V minimum voltage, and my flash activates itself on a rising edge, so that's the reason of my ePWM.






    **** SECOND ARTICLE ****

    12. Well about your second post, i understand when you say the schematic is incorrect, but they ensure me the signal is ever digitalized when the signal go through the "SPI cable"...  so if they ensure me that, AD8341 is normally a digital transmitter...
         Well if i try to use it on GPIO-pins, and in the end it's an analog signal, is there a way to discover it ?
     
    13. About the AD8341, can you give me the link where you found all informations about it please ?

    14. For the moment, i can put TI-RTOS as an option on my project, isn't it ? because it's going to take me a long time in additional of the few time i have.

    15. Well do i need to control precisely by little signal the electronic card on the spectro to operate the system ?


    Tomorrow i'm going to complete this, but this evening i didn't have the time to make research, but tomorrow in the morning i will do that ; and i'm waiting for your answers.




    Sorry for my brieves answers.


    Best Regards,
    Sébastien.

  • Hi everyone, i made a little code, but i have mistake ; can you help me about this ?

     

     

    #include "DSP28x_Project.h"
    #include <string.h>

    void readSpi(Uint16 tableau[]);

    Uint16 tableau[600]={0};
    unsigned int i=0;

    void main(void)
    {
            InitSysCtrl(); // Initialize C28 core
            EALLOW;

           GpioG1CtrlRegs.GPADIR.bit.GPIO16      = 0;       //Set as input 
           GpioG1CtrlRegs.GPADIR.bit.GPIO17      = 1;       //Set as output
           GpioG1CtrlRegs.GPADIR.bit.GPIO18      = 1;       //Set as output
           GpioG1CtrlRegs.GPADIR.bit.GPIO19      = 1;       //Set as output
           GpioG1CtrlRegs.GPADIR.bit.GPIO20      = 1;       //Set as output
           GpioG1CtrlRegs.GPADIR.bit.GPIO21      = 1;       //Set as output
           GpioG1CtrlRegs.GPADIR.bit.GPIO22      = 1;       //Set as output

           GpioG1CtrlRegs.GPAMUX2.bit.GPIO16      = 1;       //Set as SPISIMOA  (I/O)
           GpioG1CtrlRegs.GPAMUX2.bit.GPIO17      = 1;       //Set as SPISOMIA
           GpioG1CtrlRegs.GPAMUX2.bit.GPIO18      = 1;       //Set as SPICLKA
           GpioG1CtrlRegs.GPAMUX2.bit.GPIO19      = 1;       //Set as SPISTEA
           GpioG1CtrlRegs.GPAMUX2.bit.GPIO20      = 0;       //Set as GPIO20
           GpioG1CtrlRegs.GPAMUX2.bit.GPIO21      = 0;       //Set as GPIO21
           GpioG1CtrlRegs.GPAMUX2.bit.GPIO22      = 0;       //Set as GPIO22

            EDIS;

           InitCpuTimers();

           ConfigCpuTimer(&CpuTimer0, C28_FREQ, 20);

           InitSpi();
           EALLOW;

           SpiRegs.SPIBRR=0x007F;
           SpiRegs.SPICCR.bit.SPISWRESET = 1;
     
           EDIS;

           clear_buf_spi();
     
           readSpi();

    }


    void clear_buf_spi()
    {

          while(SpiRegs.SPIFFRX.bit.RXFFST!=0) //clear the buffer of reception
          {
                  SpiRegs.SPIRXBUF = SpiRegs.SPIRXBUF;
          }
    }


    void readSpi(Uint16 tableau[])
    {

     while((SpiRegs.SPICCR.bit.SPISWRESET)!=1)
     {
            ;
     }
     for(i=0;i<600;i++)
     {
            tableau[i] = SpiRegs.SPIDAT; //put data received on tableau;
     }


    }


    .Firstly, i have a mistake : #20 identifier "SpiRegs" is undefined. Do you know why ?
    .I have others questions :
      - Must i use the FIFO buffers ?
      - I'm in "C28 code", must i go to M3 after and use both of them to have results ?
      - Must i use PieVectorTable for my results on my array ?

    Regards,

    Sébastien.

  • Hi Sébastien!

    0 I think you didn't include some header-file.

    1 I would prefer

    2 Refer to http://processors.wiki.ti.com/index.php/C2000_Getting_Started_with_Code_Composer_Studio_v5 :

    The CCSv5 concept of workbench makes working with dual cores such as the C28x and CLA or the Concerto M3 and C28x. You can choose to work with both cores within one workbench, or you can open a workbench for each CPU.

    3 Yes.

    Regards,

    Igor

  • Hi!

    By the way. About SPI. Perhaps this manual will be useful 4188.TI_SPI_spra451.pdf.

    Regards,

    Igor

  • Hi !

    in fact the header files i didn't include are on a M3 workbench, and i'm going to add lines to put the array on the C-to-M RAM, and for PieVectTable too, and after read it with the M3 subsystem, so normally the header file "DSP28x_Project.h" is enough.

    ...BUT before i build both projects to see if there are mistakes.

    Moreover i don't find the interrupt for SPI... i will search again.

    Which useful SPI configurations missing except what we talked about ?

    Regards,

    Sébastien.

  • Hi!

    About SPI Interrupt look at the page 1103 etc. of your F28M35 manual.

    Regards,

    Igor

  • Bonsoir !

    Firstly Thanks for your attention and your great great... help Igor !

    Well i took the spi_loopback and others code like help, and modify it according to my situation ; well i give you my c28 and my m3 code :

    a. C28 code :


    /* *** SPI_C28.C *** */

    #include "DSP28x_Project.h"
    #include <string.h>

    #pragma DATA_SECTION(value_on_C28_part,"CtoM")// for Inter Processor Communication (IPC)
    Uint16 value_on_C28_part;

    #define CPU_FREQ     150E6      // 150MHz
    #define SPI_BAUDRATE 500000     // 500KHz
    #define LSPCLK_FREQ  (CPU_FREQ/4)
    #define SPI_BRR      (LSPCLK_FREQ/SPI_BAUDRATE)-1

    Uint16 TransmCount = 0;
    Uint16 coefficient[600]={0};
    Uint16 GPIO17_count;

    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadSize;
    extern Uint16 RamfuncsRunStart;

    void delay_loop(void);
    void spi_xmit(Uint16 a);
    void spi_fifo_init(void);
    void spi_init(void);
    void error(void);
    void gpio_init(void);

    interrupt void spi_isr(void);



    void main(void)
    {
        InitSysCtrl();
        DINT;
        InitPieCtrl();
            IER = 0x0000;
            IFR = 0x0000;

            InitPieVectTable();
            EALLOW;
            PieVectTable.SPIRXINTA=&spi_isr;
            EDIS;
            InitCpuTimers();
            ConfigCpuTimer(&CpuTimer0,CPU_FREQ,20);

            memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

            spi_fifo_init();
            spi_init();
            gpio_init();
    }



    void spi_init()
    {
        SpiaRegs.SPICCR.bit.SPISWRESET = 0;
           SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;
            SpiaRegs.SPICCR.bit.SPICHAR = (16-1);
            SpiaRegs.SPICCR.bit.SPILBK = 1;

        SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
           SpiaRegs.SPICTL.bit.TALK = 1;
            SpiaRegs.SPICTL.bit.CLK_PHASE = 0;
           SpiaRegs.SPICTL.bit.SPIINTENA = 0;

        SpiaRegs.SPIBRR = SPI_BRR;

        SpiaRegs.SPIPRI.bit.FREE = 1;

        SpiaRegs.SPICCR.bit.SPISWRESET = 1;
    }

    void spi_fifo_init()
    {
         SpiaRegs.SPIFFTX.bit.SPIRST = 0;
            SpiaRegs.SPIFFTX.bit.TXFIFO = 0;

            SpiaRegs.SPIFFTX.bit.TXFFIL = 4;
            SpiaRegs.SPIFFTX.bit.SPIFFENA = 1;
            SpiaRegs.SPIFFTX.bit.TXFFIENA = 1;
            SpiaRegs.SPIFFTX.bit.TXFIFO = 1;

           SpiaRegs.SPIFFRX.bit.RXFIFORESET = 0;
           SpiaRegs.SPIFFRX.bit.RXFFIL = 4;
            SpiaRegs.SPIFFRX.bit.RXFFINT = 1;
            SpiaRegs.SPIFFRX.bit.RXFIFORESET = 1;

            SpiaRegs.SPIFFCT.all=0x0;
            SpiaRegs.SPIFFTX.bit.SPIRST = 1;
    }

    void gpio_init()
    {
        EALLOW;

        GpioG1CtrlRegs.GPADIR.bit.GPIO16      = 0;       //Set as input
        GpioG1CtrlRegs.GPADIR.bit.GPIO17      = 1;       //Set as output
        GpioG1CtrlRegs.GPADIR.bit.GPIO18      = 1;       //Set as output
        GpioG1CtrlRegs.GPADIR.bit.GPIO19      = 1;       //Set as output
        GpioG1CtrlRegs.GPADIR.bit.GPIO20      = 1;       //Set as output
        GpioG1CtrlRegs.GPADIR.bit.GPIO21      = 1;       //Set as output
        GpioG1CtrlRegs.GPADIR.bit.GPIO22      = 1;       //Set as output

        GpioG1CtrlRegs.GPAMUX2.bit.GPIO16      = 1;       //Set as SPISIMOA (I/O)
        GpioG1CtrlRegs.GPAMUX2.bit.GPIO17      = 1;       //Set as SPISOMIA
        GpioG1CtrlRegs.GPAMUX2.bit.GPIO18      = 1;       //Set as SPICLKA
        GpioG1CtrlRegs.GPAMUX2.bit.GPIO19      = 1;       //Set as SPISTEA
        GpioG1CtrlRegs.GPAMUX2.bit.GPIO20      = 0;       //Set as GPIO20
        GpioG1CtrlRegs.GPAMUX2.bit.GPIO21      = 0;       //Set as GPIO21
        GpioG1CtrlRegs.GPAMUX2.bit.GPIO22      = 0;       //Set as GPIO22

        EDIS;
    }


    interrupt void spi_isr(void)
    {
        coefficient[TransmCount]=SpiaRegs.SPIRXBUF;
        value_on_C28_part=coefficient[TransmCount]; // load value into CtoM
        if(TransmCount==600)
            {
                TransmCount=0;
            }
        else
            {
                TransmCount++;
            }
        SpiaRegs.SPICTL.all=0;
        PieCtrlRegs.PIEACK.all=1;

        ;
    }





    b. M3 code :

    /* *** SPI_M3.c *** */

    #include "inc/hw_sysctl.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_nvic.h"
    #include "inc/hw_types.h"
    #include "inc/hw_gpio.h"
    #include "driverlib/ipc.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/debug.h"
    #include "driverlib/cpu.c"
    #include "driverlib/gpio.h"



    int main(void)
    {
        int i=0;
       
        HWREG(SYSCTL_MWRALLOW) = 0xA5A5A5A5;

        HWREG(NVIC_VTABLE) = 0x20005000;

          SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0xF) | SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_2 | SYSCTL_XCLKDIV_4);

        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
           SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);

            GPIOPadConfigSet(GPIO_PORTA_BASE, 0xFF, GPIO_PIN_TYPE_STD_WPU);
            GPIOPadConfigSet(GPIO_PORTB_BASE, 0xFF, GPIO_PIN_TYPE_STD_WPU);

           GPIOPinConfigureCoreSelect(GPIO_PORTA_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTB_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTC_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTD_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTE_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTF_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTG_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTH_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);
            GPIOPinConfigureCoreSelect(GPIO_PORTJ_BASE, 0xFF, GPIO_PIN_C_CORE_SELECT);

        HWREG(GPIO_PORTB_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;

        HWREG(GPIO_PORTB_BASE+GPIO_O_CR) |= 0x000000FF;

        for (i=0;i<20;i++){};   

        IPCMtoCBootControlSystem(CBROM_MTOC_BOOTMODE_BOOT_FROM_FLASH);

        IntMasterEnable();

        while(1);
    }
       

    c. ... AND after it, i create on debug mode the expression array "tableau", but when i activate my flash and want to see what's happening on the regs represented by my array, they give me a mistake near my expression and no values appear on my array.. Do you know why ?

    d. it's necessary to know that this code is a "general code" ; i mean i know there are lots of useless lines on my code, but i let them to understand the following of the code lines.



    Best Regards,
    Sébastien.

  • sebastien begue said:
    12. Well about your second post, i understand when you say the schematic is incorrect, but they ensure me the signal is ever digitalized when the signal go through the "SPI cable"...  so if they ensure me that, AD8341 is normally a digital transmitter...
         Well if i try to use it on GPIO-pins, and in the end it's an analog signal, is there a way to discover it ?

     from analog device site: AD8341

    1 The software you need write to perform spectrophotometry

    2 I don't remember what It was pf, it was cut was something about bare electronic dumb over smart one performing all task and furnishing result ready over raw data.

    3 spectrometry can work by a tunable light source and detector, white source and spectral analysis so I don't know enough of your but from video analog detector and ADC part I an external spectral filter is necessary to evaluate light adsorption at various frequency.

    4 if you wish use EPWM an optocoupler is slow and expensive as ISO part see HERE

    5 I don't uunderstand, no code no dialog, you need shot light and measure spectral response by software???

    6 More info about how analysis is made can answer this, again why use ePWM and not a simple timer? You need be in the in the pS range?

    7 block connected to ADC has video output is this a ccd or cmos part? has ccd internal spectrum filter?

    8 I think no you need both if I understand what you need to do, c2xxx part to perform fast hardware/software DPS action and M3 to communicate result to external interfaces.

    9 Is better to grasp fully how thing work, you need a Logic analyzer ar at almost a low cost like Saleae logic sometimes is more better this than my expensive Agilent...

    10 you need export result from your instrument and a web interface is more simple and standard as every other solution, you can use serial cable or USB but instrument work MORE BETTER is galvanically isolated from PC due to big noise they emit and ground looping. So try use a simple tcpip sample and customize to start flash then print all result, this sole a lot of hassles and is forever PLATFORM independent and no software to install on pc or other.. You can see from anywhere.

     11 ePWM is a precise PWM with resolution within pico Seconds so why use a picosend precise source to generate a simple pulse a GPIO can do at same cost? So again back why concerto if no ePWM nor precise ADC are used for????

    12, 13 done

    14 wrong move, you need make an instrument and all supporting effort from that RTOS simplify a lot all you need also communicate with TCPIP and or SPI too.

    15 I don't know more about your system so I cannot answer this question due to missing data.

     I am not forever online and next week there where some final session I need close, after that I go out for examination, session is so long and too many student are in, I cannot assure you I can follow in a timely manner then I enter summer vacation.

  • Hi Roberto ! Hi everyone !

    1&2. OK

    3.- Indeed i read the vector modulator datasheet, and
    i saw this "block" work on analog signal, like you said, AND at its output we have
     a digital signal; so CMOS doesn't make this AD conversion, so i have a digital signal on my "SPI cable".
       - Moreover, CMOS chosen aim at a precise wavelength range, and the spectral signal i want to recover is precisely on this range,
    so a filter will destroy the useful data.

    4. OK, but is there another solution for electromagnetic compatibility and protect my components by another way
    that buy an isolator ?

    5. -Sorry i think my translations are bad : "spectrometer software", before you told what is it, i thought it was the electronic card on the spectrometer.
    Yes, there isn't dialog between them, just from the processor on spectrometer ( slave ), and my DSP processor ( master ).
    ...AND yes, there was not effective code when i wrote you this message, but i just preparate the
    following states.
        -About the dialog between my CCS software and my concerto card to operate this SPI cable just above : what do you think about it ?

    6. - i thought an ePWM signal because, as i said with Igor Gorbachev, i'm going to transform the 3.3V on gpio-pins  on 6V through the 2N2222A transistor,
    and i'm going to control this 6V on output  with both transistor and the duty cycle of ePWM.
         - i give you the actuator datasheet :



    7. It's a cmos part with internal spectrum filter.

    8. Yes, that what i've try to do on a C code just above ( where i explain the problem i encountered  )

    9. OK, i will see with my enterprise !

    10. TCP/IP looks interesting but i never saw it, so don't you think it's going to take me more time ?
    so i'm going to see how it's function this week, how RTOS functions too, and see how to implement it.
    ...Just to know, what does it replace precisely ?

    11. So with my explanation i give in the sixth point, it's still better to use a simple timer to activate my command you think ?

    14. OK !

    15. Yes, the question is answered too.


    Thanks for all your help Roberto, i would need to have a professor like you ! :)
    Well you give me lots of USEFUL informations, and in every case i keep you posted of my project.

    Best Regards,
    Sébastien.

  • Salut Sébastien!

       "- i give you the actuator datasheet :"

    It seems you forgot to make attachment.

    Regards,

    Igor

  • Hi Igor !

    Sorry, this is it !

    5611.actuator S8378.pdf

    Regards,

    Sébastien.

  • Hi Sébastien!

    I have read the instructions of Roberto. He advises to use optocouplers too...There is the sense to think about it... By the way about the transistor for increasing level of GPIO-pin. Perhaps I was writing about it already. I mean the grounding. I do not recommend to aggregate the ground of power supply source of transistor and ground of your Kit directly (better via ~120 Ohm).

    Regards,

    Igor 

  • Bonsoir Igor !

    All right for the resistance.

    ...And about my question code and the code in itself, have you got an idea ?

    Have a nice week !

    Regards,

    Sébastien.

  • Salut!

    "c. ... AND after it, i create on debug mode the expression array "tableau", but when i activate my flash and want to see what's happening on the regs represented by my array, they give me a mistake near my expression and no values appear on my array.. Do you know why ?"

    I didn't understand what expression gives "error message" at debug mode? And Is compiling successful (maybe there are some wornings)? Precise please.

    Regards,

    Igor