cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

Hi

   

I am using cy8ckit -042 BLE kits and using example from the in-built examples using from PROC 4200 and selected ADC_SAR_Seq_DieTemp_PSoC4 and using the target as CYBL10563-56LQXI and giving connections from P1.5 to P12.6 and P3.0 to GND on J1.and using RS-232 with baud rate as 115200,9600,57600 and launching it on teraterm on windows 8.1 and receiving some data which is not accurate.

   

Please do let us know where we are going wrong.

   

These are the screenshots of the connections and also the RS-232.

   

Thanks

   

Srujani

0 Likes
26 Replies
Anonymous
Not applicable

These are the attachments please go through the screen shots of the serial and the code.

   

Thanks

   

Srujani

0 Likes
HeLi_263931
Honored Contributor II

Please try to create a minimal program which shows that behavior. Can you get just a serial communication to work properly? How did you configure the UART component and Teraterm? (8N1 or something different?)

   

If you cannot do that, please post you complete projects (File / Create workspace bundle).

0 Likes
Anonymous
Not applicable

I an getting the correct values for the UART but cannot get perfect values for the ADC at 115200 baudrate.

   

this is my project.

   

 

   

thanks

   

srujani

0 Likes
JoMe_264151
Expert II

Can it be that your calculation of ADCCountsCorrected  results in zero (0)

   

 

   

Bob

0 Likes
rola_264706
Honored Contributor II

I don't see anything wrong with your program it is working fine on my system.  I moved the UART pin from P0[1] to P1[5] as I don't like adding jumpers when the circuit is already there.

   

0 Likes
rola_264706
Honored Contributor II

I didn't jumper P3[2] to +3.3 Volts as shown in your picture as the ADC is not setup to cover that range of voltage.  It is set to 0 to 1.024 Volts as that is the V reference you selected. If you want to measure a higher Voltage the Settings need to be changed.

0 Likes
Anonymous
Not applicable

Hi,

   

In the picture I had a jumper connection from P3.0 to +3.3V and P1.5 to P12.6. I have ignored that connections.But that also didn't work.I have connected a jumper between P1.5 to P12.6 where that also didn't work.I even tried when there are no jumpers connected on to the board.I am getting  some data which is not exactly as yours.Can I  know the exact connections where the jumpers has to be connected on the pioneer kit.

   

Thanks

   

Srujani

0 Likes
rola_264706
Honored Contributor II

Here is the changes you need to make to the ADC_SAR_SEQ configuration  to read the Battery Voltage the new settings.

   

0 Likes
Anonymous
Not applicable

Hi,

   

I have got the output for the ADC, Now if I want to connect an external sensor to the baseboard whose output is analog where should I connect the jumper wires on the baseboard.The sensor I want to connect is LM35 on to the base board.Can you please tell how to connect them on to the pinouts on the board.

   

Thanks

   

Srujani

0 Likes
rola_264706
Honored Contributor II


I am running PSoC Creator 4.0.  Here is the new data read on the board.  One thing I think you are missing is that the jumper of J16  the voltage settings is set for 5 Volts.  So I set the jumper from P3.0 to V5.0 on J1.4

   

0 Likes
rola_264706
Honored Contributor II

Here is the Jumpers.

   

0 Likes
rola_264706
Honored Contributor II

LM35 output voltage range is -1 V to  6 volts with a 35 volt input.  The negative voltage is an issue as the PSoC device can't handle a negative input.  So you will need to have a network to prevent the voltage going below ground.

0 Likes
Anonymous
Not applicable

Thanks for the support I have finally got the ADC. In order to configure the LM35 as analog input on to the baseboards (CY8Ckit-042 BLE) and I want to use that internal ADC_SAR for converting and measure the milli volts from an output of  LM35 pin.where can I connect that analog pin of LM35 on to the base board? can u help with this..

0 Likes
Anonymous
Not applicable

this is the LM35 datasheet.

0 Likes
JoMe_264151
Expert II

There is a "Pins" entry in Creator 4.0 Workspace explorer. There you connect a pin from the topdesign window to a "real" pin on the chip. You are quite free to use any of them (marked in green), but take care, some are already in use. Refer to the schematic file of your kit which is already installed on your PC.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

I was trying to configure LM35 on to the baseboard(CY8CkIT-042 BLE & CY8C4247LQI-BL483) but was unable to print the data on output.can you suggest or help for the configuration.

   

thanks

   

srujani

0 Likes
JoMe_264151
Expert II

Now I see where your problems are.

   

         if((dataReady & ADC_SAR_Seq_1_INJ_EOC_MASK) != 0u)

   


dataready is set to zero, so the above condition will never be true. You are querying the injection channel which you do not use.

   

better use

   

ADC_IsEndConversion(ADC_WAIT_FOR_RESULT)

   

This will ensure a completed conversion of all enabled channels.

   

            dataReady &= ~ADC_SAR_Seq_1_INJ_EOC_MASK;

   

That's of no use

   

            res = ADC_SAR_Seq_1_CountsTo_mVolts(CH0_N,result[CH0_N]);

   

result[CH0_N] has never been set before, should be the result of your conversion, so you may write

   

            res = ADC_SAR_Seq_1_CountsTo_mVolts(CH0_N,ADC_SAR_Seq_1_GetResult16(CH0_N));

   

Now for

   

        printf("temperature %d",res);

   


A PSoC hasn't got an operating system, so how should the poor little chip print something and where to print it to???

   

You need to

   

place a UART (SCB) component on your topdesign. Rx and Tx pins must be P1_5 and P1_4.

   

Start the UART and use in your program

   

char Buffer[20];

   

sprintf(Buffer, "temperature %d",res);

   

UART_UartPutString(Buffer);

   

Very important: In System view: Set the heap size to 0x0200

   

Compile.

   

Download and install a terminal emulation program as PuTTY

   

In windows device manager you will see a com port that disapears when you plug off your development board. Note that port and re-plug the kit.

   

Start terminal emulation with that serial com port, use the baud rate set in the UART component. Start your program.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob,

   

I have made change in the code but getting values so differently and its always showing as 3124 and after calculation 1526.can you please tell where i am going wrong.I have given connection in hardware as vcc of LM35 to _5V,Ao pin is connected to P3.5, and ground of lm35 is given to ground to baseboard.

   

Thanks

   

Srujani

0 Likes
JoMe_264151
Expert II

Your PSoC is set to operate at 3.3V. Change that in the system setting. Verify that the board is jumpered to operate at 5V.

   

Your temperature range is +2 to 150°C as the datasheet tells, the voltage to measure (given by the formula) is in the range of 30 to 1510mV. So set the ADC as shown in the picture

   

   

 

   

See attached corrected project.

   

 

   

Bob

   

0 Likes
Anonymous
Not applicable

Hi Bob,

   

I have gone through the codes and implemented and I am getting values which are constant always when there is connection between P3.5 is connected to the analog output of LM35 it is always reading a raw value as 2048 only when there is connection and there is no connection.Can you tell me where I have gone wrong. and the LED which is also not glowing on the baseboard.

   

Thanks

   

Srujani 

0 Likes
JoMe_264151
Expert II

Difficult to find a bug without actual project. Please upload.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

This is the project I am working on.

0 Likes
JoMe_264151
Expert II

P3_5 is used on the Cy8CKIT-043 BLE by an I2C interface, use P3_3 instead.

   

Your Pin_LED is not connected to one of the on-board LEDs, see schematic.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob finally its working when its connected to P3.3 its working.

0 Likes
Anonymous
Not applicable

hello, I have a doubt .. I am working with the CY8CKIT-0420BLE  kit and the device used in my project is the CY8C4247LQI-BL483 .I am working with the ADC component and uses teraterm for recieving the commands for the ADC.

   

how do multiple pins ( say p1.4 , p3.0) serve the same functionality say uart_rx?

   

if I have connected my uart rx pin ( in the project) to p1.4 (in .cydwr) , and connect p3.0 for one ADC channel input, I assume the UART recieving will happen correctly.

   

If nothing is connected to p3.0 the teraterm works fine, but if a wire is connected between P3.0(J2) and the Gnd,and then try to read the analog channel 0(p3.0) the teraterm stops working..

   

if i repeat the same for other ADC channels, ( ADC_ch_1 at p3.1, ADC_ch_2 at p3.2) the teraterm works fine and the analog voltage is read as 0.

   

Can anyone guess what makes the teraterm stop?

   

is it because that both pins can be used as uart_rx?

0 Likes
JoMe_264151
Expert II

Welcome in the forum.

   

This is a duplicate post, please follow up here-

   

 

   

Bob

0 Likes