- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am new to development on the Cypress PSOC4 BLE module. I am simply trying to set an output pin Logic High for 1 sec and then switch to logic 0.
My problem is when I use the LED pin on board P2.6 , it works, however when I switch to any of the GPIO pins, for example P0.2, the LED is always on, even when my code is switched to 0. It is as if those pins are configured to be always high.
Any idea how to fix this?
Thanks.
Best regards,
Eugenia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which board are you using ?
Normally that would be an indication that the pin you are trying
to coNtrol is decicated on the board. or a plain old code error.
Consider posting your project, makes life easier to troubleshoot.
“File” Designer
“Archive Project”
“File” Creator
“Create Workspace Bundle”
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the CY8KIT-O42.
#include <project.h>
#include <common.h>
#include <stdio.h>
#include <stdbool.h>
int main()
{
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
/* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
for(;;)
{
int count= 0;
bool toggle = false;
/* Place your application code here. */
// switch(button_press)
{
// case START:
count++;
if (toggle)
{
start_button_control_Write(start_button_control_ON);
}
else
{
start_button_control_Write(start_button_control_OFF);
count =0;
}
if (count == 1000)
{
toggle =! toggle;
}
// break;
}
}
}
/* [] END OF FILE */
My code above works fine with the LED on board(P2.6) but not with any of the digital GPIOs. The LED always remains on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Controling GPIO -
http://www.cypress.com/?rID=93401 AN86439 - PSoC® 4 - Using GPIO Pins
Some pins on board are dedicated, pin chart -
www.dropbox.com/s/gz4q6ojg2h3p3aq/Pioneer%20Board%20Pin%20Chart.xls
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to be clear the RGB LED is fixed to three pins per the chart I sent you,
thats the board connection column in the spreadhseet.
If you look in that column there are empty entries which means the pin is
available for use, not comitted.
Make sure you use the pin APIs shown in the ap note for reading/writing.
Laslty you use delays to get your timing, that means the CPU is doing nothing during
the delay timeout. Better is to use a timer, or systick timer, to gen an interrupt periodically
and set/clear the pin there.
http://www.cypress.com/?id=4&rID=94607 PSOC 4 SysTick
To implement a C isr -
CY_ISR_PROTO(MyIntFunc); // Prototype declaration
then
CY_ISR(MyIntFunc) // Interrupt function definition
{
// Place code here
}
In initialization part of the program
isr_StartEX(MyIntFunc); // Start Interrupt with my handler
CY_ISR-macro have a look into the "System Reference Guide" under Help -> Documentation..
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not quite sure whether I understand you correctly: When you use pin P0.2 the LED will not change at all because it is connected to pin 2.6 which does not change.
The blinky example uses afaik a PWM or Timer which is hardware-connected to the LED-Pin, so the toggle of any other pin wouldn't change anything.
Please upload your complete project.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The RGB led is connected to pins P1_6, P0_2, and P0_3
respectivley.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was not paying attention, you are using the BLE board,
the pin chart not applicable.
Look at the schematic in user docs for that board.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works now.Rather than making my own delay, I used the CyDelay function. Works.
int main()
{
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
/* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
/* Set LED output state to high */
start_button_control_Write(1u);
/* Delay for 500ms */
CyDelay(500u);
/* Set LED output state to low */
start_button_control_Write(0u);
return 0;
}
/* [] END OF FILE */