13 Replies Latest reply on Dec 31, 2016 10:05 AM by user_144695799

    Help with UART data transmission

    user_144695799

      Hello,

         

      I have modified old project with 16 bit delta sigma ADC, Filter and UART. I am trying to send 16 bit ADC output to filter and further to UART. Somehow unable to get the output. Any suggestions?? 

        • 1. Re: Help with UART data transmission
          user_1377889

          You collect data with a frequency of nore than 1ksps (1000 samples per second. Your UART is not able to handle that. When transferring binary data (which is not so safe using UART) you can send with your configuration 400 sps. So you need to increase the baud rate.

             

          The data you send is not readable, it must be converted to ASCII. What do you want to do with the data on the other side of the UART?

             

          A simple solution for you is to poll the filter fro channel A data ready and then transfer the result (Converted using sprintf) to UART which has to run at 115200bd (estimated)

             

           

             

          Bob

          • 2. Re: Help with UART data transmission
            user_144695799

            Thanks Bob for the reply!

               

            I would want to send this data over wireless link such as Bluetooth and plot the collected data for monitoring. This is a prototype which I am testing. So converting in ASCII wont be required.

            • 3. Re: Help with UART data transmission
              user_1377889

              PSoC4 BLE do not have DMA afaik. So better concentrate on polling methods or interrupt driven solutions.

                 

               

                 

              Bob

              • 4. Re: Help with UART data transmission
                user_144695799

                I am having PSOC 5 LP board. Interfacing external Bluetooth module. 

                • 5. Re: Help with UART data transmission
                  user_144695799

                  It works well with 8 bit ADC. When i modified it for 16 bit ADC, its not working. Either 16 bit DMA transfer or UART data transmission is not working. Don't understand where the problem is..

                  • 6. Re: Help with UART data transmission
                    user_1377889

                                while (Filter_1_IsInterruptChannelA() == 1) Wait();                    // is this really correct???
                          // while (!Filter_1_IsInterruptChannelA() ) Wait();                             // That looks better

                       

                                myint16 = (Filter_1_Read16(Filter_1_CHANNEL_A) + 128u);

                       

                    This is the conversion of an int8 to uint8, you must change that for int16 to uint16

                       

                    UART_1: Remove the interrupt, set baud rate to 115200 and tx buffer size to 200. Keep in mind that the UART transmits a byte-stream and because every code from 0x00 to 0xff is valid, you will at the receiver side not be able to distinguish where a value ends and where a new value begins.

                       

                     

                       

                    Bob

                    1 of 1 people found this helpful
                    • 7. Re: Help with UART data transmission
                      user_144695799

                      It is working with following changes!! Thanks a lot !!

                         

                      ------------

                         

                      while (Filter_1_IsInterruptChannelA() == 1) Wait();                    // is this really correct???
                            // while (!Filter_1_IsInterruptChannelA() ) Wait();                             // That looks better

                         

                                  myint16 = (Filter_1_Read16(Filter_1_CHANNEL_A) + 128u);

                         

                      This is the conversion of an int8 to uint8, you must change that for int16 to uint16

                      • 8. Re: Help with UART data transmission
                        user_144695799

                        For UART, I changed, buffer size = 16 and oversampling rate = 16x

                        • 9. Re: Help with UART data transmission
                          user_144695799

                          This design is working with Single ended input. However not giving output with differential mode. Please have a look and suggest possible solution. Thanks in advance!!

                          • 10. Re: Help with UART data transmission
                            user_1377889

                            Starting with the ADC (which is set for 4 configurations from which you only need one):

                               
                                  
                            • Mode is set to continuous, that does not match with the soc by the PWM.
                            •     
                            • Buffer gain is set to 4 which will conflict with the 1V output of the WaveDACs and the 1.20V reference.
                            •     
                            • With 16bit resolution you should transmit a 32bit item with DMA, not only a 16bit item.
                            •    
                               

                             

                               

                            Bob

                            • 11. Re: Help with UART data transmission
                              user_144695799

                              Thanks for your time!! 

                                 

                              >> Mode is set to continuous, that does not match with the soc by the PWM.

                                 

                              >> With 16bit resolution you should transmit a 32bit item with DMA, not only a 16bit item.

                                 

                              With the same mode and 16 bit resolution with 2 byte DMA data transfer is working fine with single ended input. I verified the signal frequency and amplitude both. But same is not working with differential input. 

                                 

                               

                                 

                              >> Buffer gain is set to 4 which will conflict with the 1V output of the WaveDACs and the 1.20V reference.

                                 

                              Differential voltage would be low hence I had set the gain to 4. Also as per your suggestion have tried for less gain as well. However no change was found. Unable to still crack the problem.

                              • 12. Re: Help with UART data transmission
                                user_1377889

                                With the same mode and 16 bit resolution with 2 byte DMA data transfer is working fine with single ended input.

                                   

                                But with differential you are expecting negative values,

                                   

                                Tell more exactly what you get and what you expect.

                                   

                                 

                                   

                                Bob

                                • 13. Re: Help with UART data transmission
                                  user_144695799

                                  Yes. You have a point. I need to transfer 32 bit with 16 bit resolution.

                                     

                                  Now I am getting some data, though its not correct. It is at least giving some response.

                                     

                                  I think the byte sequence is not proper, that might be the reason, I have just modifies the number of bytes to be transferred over DMA. Are there any more settings with respect to alignments for 32 bit transfer or it will remain same as that of 16 bit transfer? as I could not find much in datasheet.