SAR ADC data write(send) to the port (GPIO) of the psoc 059lp board

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

cross mob
Anonymous
Not applicable

Dear All

   

Please help me to write the code for the given requirement.

   

I want to send the ADC data to the port. I want 500k data to read the ADC and write to the port by using 12 bit SAR ADC of PSOC059lp

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

Welcome in the forum.

   

What do you understand by "the port" where you want to send the data to? What device is sitting on "that port" and accepts the data?

   

Did you already download and install Creator 4.0?

   

Which kit have you got?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Dear sir,

   

I am using CY8CKIT-059 PSoC® 5LP Prototyping Kit. I am dealing with the analog signal frequency of 60 kHz. I want to digitized the analog signal by using 12 bit SAR adc (single ended adc) with a maximum sampling frequency(1 MSPS) for the duration of 5 miliseconds and then send adc output data  to the GPIO pin of the microcontroller or GPIO pin of CY8CKIT-059 PSoC® 5LP Prototyping Kit.  I installed the Psoc creator 4 along with  CY8CKIT-059 Kit Setup. Please help...

   

Thanks 

   

Chandan

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

There is no "the GPIO pin". You may setup a 12 bit wide interface with status/clock signals or use a standard interface as UART, I2C or SPI to shovel the data to your device (which you did not mention what it is).

   

1 Msps for 5ms are 5000 values, so you'll need 10kB temporary storage which you have got on a PSoC5. To transfer the ADC data to sram you will need to use DMA. In Creator you will find (from Start Page) a couple of examples which you can modify for your needs.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Dear sir,

   

The ADC output data I want to assign to port. 

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

Chandan, when you want me to help you, you should say something about your device that is going to get the data. Because there is no 12bit wide port I am asking that question. What are you going to do with the ADC samples sent out??

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Dear sir,

   

I want to connect Raspberry pi of 12 Gpio pin to the 12 port of Psoc 059lp prototype kit. I do not want to use internal RAM of Psoc 5. So I want to write ADC data of psoc 5 to the RAM of raspberry Pi. Please help.

   

 

   

Thanks

   

Chandan

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

Your raspberry has got

   
        
  • I2C(master)
  •     
  • SPI (master)
  •     
  • UART (tty)
  •    
   

You will need select one and write some code to get the incoming data.

   

On PSoC side you will need to buffer your data in memory because transmission speed is quite limited.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I am not saying it is impossible, but it will be at least very very hard to make the Raspberry Pi to read 12 bit parallell GPIO data input with any reasonable speed. There will also be handshaking needed and remember this type of things are usually done using Linux kernel drivers, that you probably would have to write also. Using memory mapped IO registers it is perhaps possible to do this from userspace, but there will be no guarantee that the kernel doesn't mess up the timings.

   

So the reasonable, efficient, way to get things done is to use a serial interface, UART is probably the easiest way, buffer the data in PSoC RAM and then send it over UART to the RPi.  Use ADC -> DMA -> RAM buffer. Then when the data has been sampled, let the program send the data over serial. For more speed you can use SPI but then then you will have more problems with setting up SPI to talk nicely from both sides. Its really a question of how much time and effort debugging communications problems you can spend, compared to the safe but slow way. If I were you I would first make UART data transfer work, and then if I need more speed look at how this can be improved. Perhaps by using USB_SERIAL,  this can improve speed quite a bit.

   

Writing an RPi program to read the incoming UART serial data is standard.

0 Likes
Anonymous
Not applicable

Dear Sir/Madam

   

I am thank full for your response. Since my signal frequency in the range of 60kHz to 100kHz. I need fast data transmission . In the UART communication has a maximum speed of  460 Kbps. Thats why I need GPIO read and write to RAM of Raspberry Pi for the fast data transfer RAM and send it via Wi-Fi communication.

   

Thanks

   

Chandan

0 Likes
Anonymous
Not applicable

Well USB UART can handle up to 10Mbit/s, if the OS allows it and they are well programmed.

   

Unfortunately these are the limitations of the platforms you work with so you need GPIO  am afraid you will have to do most of the work yourself.

   

Setting out 12 output pins on one port on CY8CKIT-059 will probably not work, but you can use something like four groups of four pins, you will need handshaking. These cannot be written by DMA but it must be done under firmware control. For 100 kHz it should be possible, I am afraid the RPi side will be much harder.

0 Likes
Anonymous
Not applicable

Right sir, Setting out 12 output pins on one port on CY8CKIT-059 will probably not work, so I am using 8 and 4 group of pin. As part of Raspberry Pi side I am trying. I want to take the advantage of Wi-Fi communication inbuilt with Raspberry Pi.

   

Thanks

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        Chandan, In post #15 of this thread http://www.cypress.com/forum/psoc-5-device-programming/simultaneous-sampling-two-channels-using-samp... there is an example of the custom ADC_SAR component, which is essentially Cypress stock component modified with hardware output bus, which you can route to any output pins. This solves the problem of outputting the signal. Now what you are going to do with it is entirely up to you.   
0 Likes