Author: HongyanW_86 Version: **
In Traveo™ II MCU, after the CAN FD message in the Tx buffer is transmitted, the corresponding bit of the CANFDx_CHx_TXBTO register is set, but it will be reset only when a new transmission is requested. Therefore, the last transmitted Tx buffer index may not be identified directedly by the value in the CANFDx_CHx_TXBTO register.
See the following description of the CANFDx_CHx_TXBTO register in TVII-B-E-1M Register TRM (002-19567 Rev. *F):
An alternative software method to get the Tx buffer index is shown in the following example:
//Enable one Tx buffer interrupt
pstcCanFD->M_TTCAN.unTXBTIE.u32Register = 1ul << vTxBufferIndex;
//Transmit Tx message in the Tx buffer
Cy_CANFD_UpdateAndTransmitMsgBuffer(CY_CANFD_TYPE, vTxBufferIndex, &stcMsg);
//Get TXBTIE register value
vTxBufIntStatus = pstcCanFD->M_TTCAN.unTXBTIE.u32Register;
//Check bits of register TXBTIE and TXBTO
for(vIndex=0;vIndex < 32;vIndex++)
{
vTxbufStatus = Cy_CANFD_GetTxBufferStatus(pstcCanFD,vIndex);
//TXBTIE.bit == 1 and TXBTO.TOx =1, TX buffer transmit occured/successful and TXBCF.CFx =0 no cancel
if (((1ul << vIndex)& vTxBufIntStatus) && (vTxbufStatus == CY_CANFD_TX_BUFFER_TRANSMIT_OCCURRED))
{
//disable Tx buffer interrupt
pstcCanFD->M_TTCAN.unTXBTIE.u32Register = 0x00000000;
//vIndex is the last transmitted Tx buffer index
gTxBufferIndex = vIndex;
}
}
Japanese version: Traveo II MCU を J-Link でデバッグ、プログラムをする方法 - KBA22845... - Cypress Developer Community
Author: HongyanW_86 Version: **
The J-Link driver V6.48a or later version has added support for Traveo II devices. With the updated J-Link driver, Traveo II programming in J-Flash and debugging in IAR Embedded Workbench or Ozone J-Link debugger software work as expected for both CM0+ and CM4 core.
1. Debug Traveo II in IAR Embedded Workbench
Currently there is an issue in IAR Embedded Workbench if you try to debug both CM0+ and CM4 projects at the same time.
2. Multi-core debug Traveo II in Ozone
Author: ShusakuS_56 Version: **
Question:
I want to know the execution time of some software. Is there a method to measure the execution time without using a debugger?
Answer:
You can measure the approximate software execution time using the hardware timer (TCPWM). Here is the code snippet for "Hello World".
Code 1. Original “Hello World”
#include <stdio.h> int main() { printf("Hello World"); return 0; } |
To measure software execution time, make the following modifications to the “Hello World” code:
1. Add the TCPWM timer start command and the TCPWM timer stop command before and after printf ("Hello World"); to the ”.
Code 2. Adding TCPWM Timer Start and Timer Stop Commands
#include <stdio.h> int main() { // Initialize Clock Divider and TCPWM (For more details, please see Technical Reference Manual) : // If you need, please Enter Critical section to avoid any interrupt during measurement. uint32_t saveIntrEnabled = Cy_SysLib_EnterCriticalSection(); // Interrupt Disable & Save Current Status : // Timer Stop/Clear/Start (Please use INLINE function to reduce software offset like below) TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1STOP = 0x01; // Timer Stop Command (If Timer is Starting) TCPWM0_GRPx_CNTx_COUNTER->unCOUNTER.u32Register = 0UL; // Timer Counter Clear Command TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1START = 0x01; // Timer Start Command printf("Hello World"); // Timer Stop (Please use INLINE function to reduce software offset like below) TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1STOP = 0x01; // Timer Stop Command // Read and Save the counter value uint32_t TimerCount = Cy_Tcpwm_Counter_GetCounter(TCPWM0_GRPx_CNTx_COUNTER); : // If you need, restore interrupt status Cy_SysLib_ExitCriticalSection(saveIntrEnabled); // Interrupt Restore Previous Status return 0; } |
2. Then, add a command to read the timer value of the corresponding TCPWM. This timer value counts the number of clocks. Therefore, the software execution time can be calculated as:
[Example] Clock Frequency = 20 MHz, Value of TimerCount = 0xF000 (0d61440)
To make the measurement time more accurate, take the following measures.
#include <stdio.h> int main() { : // Timer Stop/Clear/Start (Please use INLINE function to reduce software offset like below) TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1STOP = 0x01; // Timer Stop Command (If Timer is Starting) TCPWM0_GRPx_CNTx_COUNTER->unCOUNTER.u32Register = 0UL; // Timer Counter Clear Command TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1START = 0x01; // Timer Start Command printf("Hello World"); // Timer Stop (Please use INLINE function to reduce software offset like below) TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1STOP = 0x01; // Timer Stop Command // Read and Save the counter value uint32_t TimerCount = Cy_Tcpwm_Counter_GetCounter(TCPWM0_GRPx_CNTx_COUNTER); : // Measure the time from starting the counter to stopping TCPWM0_GRPx_CNTx_COUNTER->unCOUNTER.u32Register = 0UL; // Timer Counter Clear Command TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1START = 0x01; // Timer Start Command TCPWM0_GRPx_CNTx_COUNTER->unTR_CMD.stcField.u1STOP = 0x01; // Timer Stop Command uint32_t SwOffsetCount = Cy_Tcpwm_Counter_GetCounter(TCPWM0_GRPx_CNTx_COUNTER); uint32_t TimerCountDuringHelloWorld = TimerCount – SwOffsetCount; return 0; } |
Note: This KBA applies to the following series of Traveo II MCUs:
Show Less
Author: ShusakuS_56 Version: **
Question:
Why doesn't the counter start when I enable the counter in TCPWM?
Answer:
If the counter does not start, make sure that the following are set correctly:
(1) CLK Setting
(2) Hardware control signals
(1) CLK Setting
TCPWM has a system clock and a counter clock.
The system clock is supplied from CLK_PERI via a divider. This clock is used for trigger synchronization.
The counter clock is supplied from CLK_PERI via Peripheral Clock Dividers. This clock is used for counter control. You should set the clock for each counter.
The number of these clocks differs for the CYT2B/CYT4B/CYT4D series. For more details, see the "Clock Diagram" section in the corresponding datasheet.
(2) Hardware control signals
Even if the counter is enabled, the counter does not start unless the counter's hardware control signals (Reload, Start, Stop, Count, Capture0, Capture1) are enabled. The counter's hardware control signals must be selected from the following Trigger Input signal using the “TCPWMx_GRPy_CNTz_TR_IN_SEL0” and “TCPWMx_GRPy_CNTz_TR_IN_SEL1” register.
- Fixed at ‘0’ or ‘1’
- Connect signals from the output of other peripherals or external terminals via the Trigger Multiplexer block.
[Example]
In timer mode, hardware control signals are used as follows:
- Reload : Active "H". Initializes and starts the counter.
When "H" is supplied, the counter starts from the initial value (Up mode: 0, Down mode: period).
If neither Reload nor Start is supplied, the counter will not start.
- Start : Active "H". Starts the counter.
When "H" is supplied, the counter starts from the current counter value.
If neither Reload nor Start is supplied, the counter will not start.
- Stop : Active "H". Stops the counter.
When "H" is supplied, the counter does not start.
- Count : Active "H". Count event increments/decrements the counter.
When "L" is supplied, the counter does not start.
- Capture0 : Not used.
- Capture1 : Not used.
These signals can also be generated by with the TCPWMx_GRPy_CNTz_TR_CMD register.
For more details, see the "Timer, Counter, and PWM" section in the corresponding Technical Reference Manual.
Note: This KBA applies to the following series of Traveo II MCUs:
TCPWM Interrupt Does Not Occur in Traveo II Fam... | Cypress Developer Community
Show LessAuthor: ShusakuS_56 Version: **
Question:
I am generating an interrupt to the CPU with the TCPWM Counter Overflow (OV) event. However, when the reload signal is input to the counter, no interrupt occurs. How do I generate an interrupt when a reload signal is input to the counter?
Answer:
When a reload signal is input to the TCPWM counter, overflow of the counter occurs, but no TC event occurs. This is as specified.
If you want to generate an interrupt even when a reload signal is input to the counter, use a compare match to generate an interrupt.
For example, set the compare value to "0" in the "TCPWMx_GRPy_CNTz_CC0" register and enable CC0_MATCH in the “TCPWMx_GRPy_CNTz_INTR” register. When the counter is set to "0" by the reload signal, it matches the compare value. Therefore, a compare match interrupt is generated as shown below. ('x' signifies the TCPWM instance number, 'y' is the group number and 'z' is the counter in the respective TCPWM group.)
Note that Interrupts are counter mode specific and can be generated for a Terminal Count (TC) or Compare/Capture0/1 (CC0/1) event.
For more details, see the "Timer, Counter, and PWM" section in the corresponding the Technical Reference Manual:
Note: This KBA applies to the following series of Traveo II MCUs:
Author: ShusakuS_56 Version: **
Question:
In Traveo™ family, if a new A/D conversion is started before the previous A/D conversion result is read, the next conversion will start; however, the result will not be saved. Can this feature be used in Traveo II Family?
Answer:
No. This feature is different for Traveo and Traveo II. In Traveo II, new results are overwritten.
For more details, see the "SAR ADC" section in the corresponding the Architecture Technical Reference Manual:
Note: This knowledge base article applies to the following series of Traveo II MCUs:
Author: ShusakuS_56 Version: **
Question:
Can the Arm® Cortex®-M4/M7 and Cortex-M0+ cores in Traveo™ II family be debugged from the same JTAG?
Answer:
Yes. Both cores can be debugged from the same JTAG. For details of the debugger, contact the following third parties:
Note: This KBA applies to the following series of Traveo II MCUs:
Author: ShusakuS_56 Version: **
Question:
Traveo™ II has a Cortex-M0+ core in addition to the Cortex-M4/M7 core. To reduce the load on the Cortex-M4/M7 core, I want the Cortex-M0+ core to process some of the load. Is that possible?
Answer:
Yes. It is possible. However, the Cortex-M0+ core is basically used for security processing. Please verify the security processing on your system.
Note: This KBA applies to the following series of Traveo II MCUs:
- CYT2B Series
- CYT4B Series
- CYT4D Series
Show Less