1 2 Previous Next 20 Replies Latest reply on Nov 4, 2019 8:19 PM by AH_96

    Which psoc more convenient ==>PSOC6 or 5  or 3

    BUTA_1301626

      I have a project to use SPI communication.I need to change the register values of the module I will communicate with.

       

      adress==>6F    (function ==>TX Data Rate 0)      (txdr[7])     (txdr[6])     (txdr[5])     (txdr[4])     (txdr[3])     (txdr[2])     (txdr[1])     (txdr[0])       ======>3Dh

                                                                                        0                   0             1                1              1                 1                 0                1

      I want to upload 3dH to 6F adress.

      PSOC3==> 8051

      PSOC35  and PSoC6 ==> ARM cortex

      Since PSOC3 is 8051, I should prefer my PSOC3.

        • 1. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
          AH_96

          Hi BUTA_1301626

           

          I believe this is a continuation to this thread.

          The SPI component versions are same in both 5LP and 3, therefore, the functionality would be silimar. We recommend using the new devices for better features.

           

          Thanks and regards

          Hari

          • 2. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
            BUTA_1301626

            Hi Hari;

            Yes the continuation of the subject. but nobody helped.

             

            I still don't know how to upload 3dH to 6F adress.

            for example ==> For Arduino==> spi_write(0x6F, 0x3D);

            Can not perform the same process psoc?

            adress==>6F    (function ==>TX Data Rate 0)      (txdr[7])     (txdr[6])     (txdr[5])     (txdr[4])     (txdr[3])     (txdr[2])     (txdr[1])     (txdr[0])       ======>3Dh

                                                                                              0                   0             1                1              1                 1                 0                1

            • 3. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
              AH_96

              Hi BUTA_1301626

               

              In arduino, the library directly supports this functionality, but we dont have a similar library for PSoC. You can port the library to PSoC creator and use the functions normally since both are embedded C. There are only minor changes with component APIs and this must be changed for PSoC.

               

              Thanks and regards

              Hari

              • 4. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                BUTA_1301626

                Hi Hari;

                Do you know how to make a change?

                spi_write(0x6F, 0x3D); ==>I know this command does not work in psoc. I know this is an arduino command.

                I have been dealing with this process for a long time and I could not.

                this is the purpose of my forum writing. I can't do I want to know how it's done or I want to know where I'm doing it wrong.

                Is there anyone who can help me with this?

                • 5. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                  AH_96

                  Hi BUTA_1301626

                   

                  Can you share the latest library file that can be used to interface with the sensor?

                   

                  Thanks and regards

                  Hari

                  • 6. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                    BUTA_1301626

                    Hi Hari;

                    I added the arduino files.

                    I added the file I edited for PSOC.

                    • 7. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                      AH_96

                      Hello BUTA_1301626

                       

                      Going through the Arduino files, the implementation is based on pin toggles only. So, you can import these files and change the Arduino commands to PSoC commands such as digitalWrite must be replaced with Pin_Write. You can define 4 pins for MOSI, MISO, SCLK and SS.

                       

                      Referring to the datasheet of, the addressing is straightforward. It is one bit of R/W followed by 7bits of address and 8 bits of data. So, you can also try to increase the data bits of the SPI component.

                       

                      You can then send a 16bit data by concatenating R/W, Address and Data.

                      This can be done by,

                       

                      uint8 rw = 0;

                      uint8 addr = 0x6F;

                      uint8 data = 0x3D;

                      uint16 spidata = 0x00;

                      spidata = (uint16) (rw<<15)| addr<<8 | data;

                       

                      This will concatenate the data its properly and this can be transmitted using SPIM_WriteTxData. Please note that the maximum speed possible in the transceiver module is 10MHz so the speed has to be lower than this.

                       

                      Since I don't have this controller at my end, I cannot try out the project to see if it is working..

                       

                      Thanks and regards

                      Hari

                      • 8. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                        BUTA_1301626

                        Hi Hari;

                        which code would be more accurate?

                         

                        SPIM_WriteTxData(0x6F3D);

                                          or

                        uint8 buf[2]={0x6F, 0x3D};

                        SPIM_PutArray(buf, byteCount);

                        • 9. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                          AH_96

                          Hi BUTA_1301626

                           

                          Since I don't have the transceiver at my end, I cannot test this and tell you which is more accurate. Please try both methods to see their functionality.

                          Based on reading the device datasheet however, I feel that

                          SPIM_WriteTxData(0x6F3D);

                          would be a better implementation as it agrees directly with the frame format.

                           

                          If you have any queries after the implementation, please feel free to post it in this thread.

                           

                          Thanks and regards

                          Hari

                          1 of 1 people found this helpful
                          • 10. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                            BUTA_1301626

                            Hi Hari;

                            adress ==>0x07 data==>RF22_PWRSTATE_READY   ==> data is the variable RF22_PWRSTATE_READY.

                            SPIM_WriteTxData(0x07??);  how can i write this operation.

                             

                            • 11. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                              AH_96

                              Hi BUTA_1301626

                               

                              You can follow a similar explanation as the previous response, by adding the data into a 16bit variable and transmitting it.

                              That is, in the case that is mentioned, assuming we have to write RF22_PWRSTATE_READY in address 0x07, the code would be

                               

                              uint8 rw = 0;

                              uint8 addr = 0x07;

                              uint8 data = RF22_PWRSTATE_READY ; //where RF22_PWRSTATE_READY  variable holds the data

                              uint16 spidata = 0x00;

                              spidata = (uint16) (rw<<15)| addr<<8 | data;

                              SPIM_WriteTxData (spidata);

                               

                              Please try this out and let us know if it works. You can also probe the lines to see if the data is actually transmitted according to the conditions that you require. You can compare the waveform with that obtained from some other controllers for reference.

                               

                              Thanks and regards

                              Harigovind

                              1 of 1 people found this helpful
                              • 12. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                                MoTa_728816

                                Hi,

                                 

                                I'm just curious but in the data sheet

                                rw =1 for write and rw = 0 for read (page 15)

                                 

                                So how about writing a simple function

                                and reuse it for different address/data?

                                 

                                ===================

                                void spi_write(uint8_t address, uint8_t data)

                                {

                                   uint16_t buf ;

                                   buf = 0x8000 | (address << 8) | data ;

                                   SPIM_WriteTxData(buf) ;

                                }

                                ===================

                                Note: if name spi_write() conflicts, use my_spi_write() or something like that.

                                 

                                moto

                                • 13. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                                  BUTA_1301626

                                  I compiled the program without error. but the rf module still did not work.I have a few questions about this.

                                  1. I set the pins as input and output. Are the drive mode and initial drive state settings very important?

                                  input ==> drive mode ==> high impedance digital initial drive state ==> low

                                  output ==> drive mode ==> strong drive initial drive state ==> low                                    is it true?

                                  MOSI, OUTPUT

                                  MISO, INPUT

                                  SCK, OUTPUT

                                  RESET, OUTPUT

                                  nIRQ0, INPUT

                                  nCS, OUTPUT

                                  TXEN, OUTPUT

                                  RXEN, OUTPUT

                                  2. I used the clock 75khz. This is clock digital. Can I set analog? Is it a problem if I set it?

                                  3.Can I set the voltage to 3.3V to operate the module with the kit? I tried to do the system settings but did not.

                                  • 14. Re: Which psoc more convenient ==>PSOC6 or 5  or 3
                                    AH_96

                                    Hello BUTA_1301626

                                     

                                    In your code, you have combined the two suggestions mentioned in my previous response. In PSoC you are not supposed to use software APIs (such as Pin_Write) when the pin is connected to a hardware block. That is, in your design, SCK, nCS and MOSI are connected to the SPI hardware block and you are trying to change it in firmware by writing CSK_Write(0) etc. This is not allowed

                                     

                                    In the current implementation, remove the SPI block and see if the code works.

                                    Also, probe the SPI lines to make sure that there is activity on the SPI bus.

                                     

                                    Thanks and regards

                                    Hari

                                    1 2 Previous Next