Help with UART data transmission

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
dhgac_296796
Level 4
Level 4
First like given

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?? 

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

View solution in original post

0 Likes
13 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes

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.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

   

 

   

Bob

0 Likes
dhgac_296796
Level 4
Level 4
First like given

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

0 Likes
dhgac_296796
Level 4
Level 4
First like given

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..

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

            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

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

0 Likes
dhgac_296796
Level 4
Level 4
First like given

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

0 Likes
lock attach
Attachments are accessible only for community members.
dhgac_296796
Level 4
Level 4
First like given

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!!

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes

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.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes

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. 

0 Likes