PSoC™ 6 Forum Discussions
Hello,
I have configured CAN controller to recieve packets. But it does not seem to read any packets. I have connected Cy8c6244Lqi micocontroller with CAN Transceiver and at other end connected Peak CAN to laptop.
1. PCAN configuration, b/w CAN_l and CAN_h 120ohm register has been connected.
2. On transceriver, RX pin I could see waveform, so confirm that packets are received at end, but micocontroller do not detect the packets.
3. CAN configuration,
Pin 5,0 configured for CAN Rx. Tried with slew rate fast and slow.
Pin 5, 1 configured as CAN tx
3. Microcontroller firmware
bool InitCAN()
{
bool RetStatus = false;
cy_en_canfd_status_t CANSysRetStatus = CY_CANFD_SUCCESS;
cy_en_sysint_status_t INITSysRetStatus = CY_SYSINT_SUCCESS;
cy_en_gpio_status_t ret = Cy_GPIO_Pin_Init(USER_CAN_RX_PORT, USER_CAN_RX_NUM, &USER_CAN_RX_config);
printf(" GPIO init %u 5.0", ret);
ret = Cy_GPIO_Pin_Init(USER_CAN_TX_PORT, USER_CAN_TX_NUM, &USER_CAN_TX_config);
printf(" GPIO init %u 5.1", ret);
uint32_t status = (CY_CANFD_RX_BUFFER_NEW_MESSAGE | /* Message stored to Rx Buffer */
CY_CANFD_RX_FIFO_1_NEW_MESSAGE | /* Rx FIFO 1 New Message */
CY_CANFD_RX_FIFO_0_NEW_MESSAGE | /* Rx FIFO 0 New Message */
CY_CANFD_TRANSMISSION_COMPLETE |
CY_CANFD_TRANSMISSION_CANCEL_FINISHED |
CY_CANFD_TX_EVENT_FIFO_NEW_ENTRY |
CY_CANFD_TX_FIFO_EMPTY);
Cy_CANFD_SetInterruptMask(CANFD0, 0UL, status);
Cy_CANFD_SetInterruptLine(CANFD0, 0UL, Cy_CANFD_GetInterruptLine(CANFD0, 0UL) |
CY_CANFD_TRANSMISSION_COMPLETE);
uint32_t channelMask = 0x00000001UL; /* Enable the first channel */
Cy_CANFD_Enable(CANFD0, channelMask);
if (Cy_CANFD_IsInterruptLineEnabled(CANFD0, 0UL, CY_CANFD_INTERRUPT_LINE_0_EN))
{
printf("Interrupt line is enabled \r\n");
}
else
{
Cy_CANFD_EnableInterruptLine(CANFD0, 0UL, CY_CANFD_INTERRUPT_LINE_0_EN);
//Cy_CANFD_EnableInterruptLine(CANFD0, 0UL, CY_CANFD_INTERRUPT_LINE_1_EN);
printf("Interrupt line is enabled \r\n");
}
Cy_CANFD_EnableInterruptLine(CANFD0, 0UL, CY_CANFD_INTERRUPT_LINE_0_EN);
if(CY_CANFD_SUCCESS == (CANSysRetStatus = Cy_CANFD_Init (CANFD0, 0, &CAN_CHANNEL_config, &CAN_CHANNEL_context)))
{
/* Enable for configuration changes to set Test mode */
Cy_CANFD_ConfigChangesEnable(CANFD0, 0);
/* Sets the Test mode configuration */
Cy_CANFD_TestModeConfig(CANFD0, 0, CY_CANFD_TEST_MODE_DISABLE);
/* Disable for configuration changes */
Cy_CANFD_ConfigChangesDisable(CANFD0, 0);
uint32_t status = (CY_CANFD_RX_BUFFER_NEW_MESSAGE | /* Message stored to Rx Buffer */
CY_CANFD_RX_FIFO_1_NEW_MESSAGE | /* Rx FIFO 1 New Message */
CY_CANFD_RX_FIFO_0_NEW_MESSAGE); /* Rx FIFO 0 New Message */
Cy_CANFD_SetInterruptMask(CANFD0, 0UL, status);
/* Hook the interrupt service routine and enable the interrupt */
if(CY_SYSINT_SUCCESS == (INITSysRetStatus = Cy_SysInt_Init(&irq_cfg, &CANInterruptHandler)))
{
NVIC_EnableIRQ(canfd_0_interrupts0_0_IRQn);
RetStatus = true;
}
else
{
CANErrorsStatus = CAN_INIT_ERROR;
}
if(CY_SYSINT_SUCCESS == (INITSysRetStatus = Cy_SysInt_Init(&irq_cfg1, &CANInterruptHandler1)))
{
NVIC_EnableIRQ(canfd_0_interrupts1_0_IRQn);
RetStatus = true;
}
else
{
CANErrorsStatus = CAN_INIT_ERROR;
}
if(CY_SYSINT_SUCCESS == (INITSysRetStatus = Cy_SysInt_Init(&irq_cfg2, &CANInterruptHandler2)))
{
NVIC_EnableIRQ(canfd_0_interrupt0_IRQn);
RetStatus = true;
}
else
{
CANErrorsStatus = CAN_INIT_ERROR;
}
}
else
{
CANErrorsStatus = CAN_INIT_ERROR;
}
...............................................................................................................................
cy_stc_canfd_context_t CAN_CHANNEL_context; /* This is a shared context structure,
* unique for each channel
*/
const cy_stc_sysint_t irq_cfg =
{
.intrsrc=canfd_0_interrupts0_0_IRQn,
.intrPriority = 6UL /* Interrupt priority */
};
const cy_stc_sysint_t irq_cfg1 =
{
.intrsrc=canfd_0_interrupts1_0_IRQn,
.intrPriority = 6UL /* Interrupt priority */
};
const cy_stc_sysint_t irq_cfg2 =
{
.intrsrc=canfd_0_interrupt0_IRQn,
.intrPriority = 6UL /* Interrupt priority */
};
/* CANFD interrupt handler */
void CANInterruptHandler(void)
{
/* Just call the IRQ handler with the current channel number and context */
Cy_CANFD_IrqHandler(CANFD0, 0, &CAN_CHANNEL_context);
}
/* CANFD interrupt handler */
void CANInterruptHandler1(void)
{
/* Just call the IRQ handler with the current channel number and context */
Cy_CANFD_IrqHandler(CANFD0, 0, &CAN_CHANNEL_context);
}
/* CANFD interrupt handler */
void CANInterruptHandler2(void)
{
/* Just call the IRQ handler with the current channel number and context */
Cy_CANFD_IrqHandler(CANFD0, 0, &CAN_CHANNEL_context);
}
..................................................................................................................
void CANTxCallback(void)
{
}
void CANRxCallback(bool rxFIFOMsg, uint8_t msgBufOrRxFIFONum, cy_stc_canfd_rx_buffer_t* basemsg)
{
printf("Data received \n\r");
}
void CANErrCallback(uint32_t errorMask)
{
printf("CAN error \n\r");
}
.............................................................................................................
No interrupts are detected using breakpoints in interrupt handler and neither Rx callback or error callback hit. I have tried test methods for internal loop back and external loop back by sending packets and tried to recieve, but that also not worked.
Please help me to figure out in case i am missing any thing. I have taken reference from PDL library documentation "pdl_api_reference_manual".
Thanks.
Show Less
Dear Receiver,
In some GPIO sample codes, we can see their initial process with "retarget-io" function.
But in some GPIO sample codes, we don't see "retarget-io" function.
So I feel a little confused about ,,,
Is "retarget-io" a standard process to initial a GPIO ?!
When we need to use "retarget-io" function ?!
Thank you so much.
Show LessHi
I am evaluating the suitability of ESP8266 module for a MQTT based Wifi application and have few questions as below
Has anyone experienced this ESP8266 module in their projects?
- ESP8266 module suitability for the purpose requested. (any controller additionally needed or it is already available)
- Data such RF/WiFi signal strength indications and any other parameter required for distance/location identification, power level adjustments, the way to read them (dev environment like Arduino IDE), scanning the network to identify devices in the field, etc., - How well is this supported in the ESP8266 and are they configurable?
- MQTT stack availability for 8266 - Is inbuilt stack available or need to buy COTS SW
- Configuration of WiFi and MQTT from remote server on PC side - is it configurable from an external SW application running on a PC side ?
5. Is it a standalone MCU or an add on module to another MCU that will talk over RS485 or SPI and exchange data in a DPRAM styled interface.
Please let me know how well is ESP8266 support on these points.
Thanks in advance,
S
Show LessHI, I'm trying to configure the USB block in PSOC6 to operate correctly via DMA. The pieces of information are there, but I find obscure how to put them together. I seems that most of the configuration can be done in Modus Toolbox with Device Configurator, but what parts must be completed in user code to get it up and running?.
Also,I can't fine the answer of how to handle some comon situations, like, how to work with data blocks larger than the internal EP buffer, or, how to dynamically adjust for different message lengths.
Is there a working example somewhere ?
This AN228753_DMA_on_PSoC_6_MCU-ApplicationNotes is a good start to understand how DMA works, but it doesn't touch the case of a USB peripheral. I think that this case deserves an application note by itself.
Thanks!
Show LessDear Receiver,
In many sample codes, we can see parameters type " cy_rslt_t ".
For example, we can refer to the attached file.
In the attached file we can see there are 2 different types of GPIO initial process.
1. result = cyhal_gpio_init(...);
2. cyhal_gpio_init(...);
What's are their differences ?! I think above No.2 is enough to initial an IO.
Why we use "cy_rslt_t result ;" and result = cyhal_gpio_init(...) ; to initial an I/O ?!
I know "result " may be a combined parameter but I can't see its function in the attached file.
Thank you so much.
Show LessIt would be great if anyone could provide us with some suggestions for setting the parameters for CSD especially (noise threshold etc.) to A. improve the proximity sensing range & B. get rid of the baseline resetting issue. If it's possible, could you also provide suggestions on the two points above for CSX?
Thank you so very much and have a nice day!
Hi,
I would like to program my custom board ( CY8C6247FDI-D32T )with any standard third party programmers/debuggers. Is SEGGER J-Link supported for PSoC 6 in PSoC Creator 4.2 ? The interface i prefer is SWD.
regards,
Vinu
Show Less
Hello,
I have built a circuit and I am trying to measure the ADC voltage and display it in the terminal but its not working. I have attached the project. Can anyone help please?
Show LessHi,
I want to run watchdog timer in interrupt mode in PSOC 6 CM0+ core. I referred and copied the CM4 WDT examples and ported the code for CM0 core. However, i am unable to WDT interrupt or MCWDT interrupt.
I even tried the WDT workaround below, but of no success:
Workaround for PSoC 6 MCU Device ILO Start Failure in PSoC Creator 4.2 – KBA229046
Please note that i am using :
- CY8CKIT-062-WiFi-BT PSoC 6 WiFi-BT Pioneer Kit 1.0 Rev.**
- Peripheral Driver Library 3.0.1
- PSoC Creator 4.2
best regards,
Vinu
Show Less