Part Number:LAUNCHXL-CC1310Other Parts Discussed in Thread:CC1310
插入调试器,显示有两个串口,这两只跟串口要怎么用起来?
Alex Zhang:
您好,xds110 class application 用于您这边的串口调试工具。
,
genyi liu:
xds110 class auxiliary Data Port 要怎么使用?
,
Alex Zhang:
xds110 class application 用于您这边的串口调试以及debug使用
xds110 class auxiliary Data Port 用于 SWO功能。
,
genyi liu:
有xds110 class auxiliary Data Port 的使用demo吗?
,
Alex Zhang:
你现在有什么需求以及问题。
,
Alex Zhang:
genyi liu said:有xds110 class auxiliary Data Port 的使用demo吗?
demo的话我这边没有
,
genyi liu:
想使用swo 功能
,
Alex Zhang:
https://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_swo_trace.html
,
Alex Zhang:
Alex Zhang said:software-dl.ti.com/…/quote]
请按照链接步骤去参考。
,
genyi liu:
已经按照链接步骤去参考,还是用不起来,
,
Alex Zhang:
您参考链接,进行到哪一步出现问题了。
,
genyi liu:
,
Alex Zhang:
您这边是找不到这个示例代码的api对吗?
,
genyi liu:
是的
尝试自己添加也没有效果
,
Alex Zhang:
好的,我将会查看一下这个问题,这需要一些时间。谢谢。
,
Alex Zhang:
您好,我在cc13xx 26xx的工程目录下,找到了ITM.c以及ITM.h 文件,是在tracer里面找到的,您这边看一下对您有没有帮助,
itm.c
/******************************************************************************@fileitm.c@brief Provides ITM module functionsGroup: WCS, LPCTarget Device: cc13xx_cc26xx******************************************************************************Copyright (c) 2011-2022, Texas Instruments IncorporatedAll rights reserved not granted herein.Limited License.Texas Instruments Incorporated grants a world-wide, royalty-free,non-exclusive license under copyrights and patents it now or hereafterowns or controls to make, have made, use, import, offer to sell and sell("Utilize") this software subject to the terms herein. With respect to theforegoing patent license, such license is granted solely to the extent thatany such patent is necessary to Utilize the software alone. The patentlicense shall not apply to any combinations which include this software,other than combinations with devices manufactured by or for TI ("TIDevices"). No hardware patent is licensed hereunder.Redistributions must preserve existing copyright notices and reproducethis license (including the above copyright notice and the disclaimer and(if applicable) source code license limitations below) in the documentationand/or other materials provided with the distribution.Redistribution and use in binary form, without modification, are permittedprovided that the following conditions are met:* No reverse engineering, decompilation, or disassembly of this softwareis permitted with respect to any software provided in binary form.* Any redistribution and use are licensed by TI for use only with TI Devices.* Nothing shall obligate TI to provide you with source code for the softwarelicensed and provided to you in object code.If software source code is provided to you, modification and redistributionof the source code are permitted provided that the following conditions aremet:* Any redistribution and use of the source code, including any resultingderivative works, are licensed by TI for use only with TI Devices.* Any redistribution and use of any object code compiled from the sourcecode and any resulting derivative works, are licensed by TI for useonly with TI Devices.Neither the name of Texas Instruments Incorporated nor the names of itssuppliers may be used to endorse or promote products derived from thissoftware without specific prior written permission.DISCLAIMER.THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESSOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIESOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORYOF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDINGNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.***********************************************************************************************************************************************************//* Standard Includes */ #include "itm.h" #include "itm_private.h" #include <stdint.h>#include <stdbool.h> #include <string.h>#include <ioc.h>#define ITM_STIM_PORT_8(x)(*(volatile uint8_t *) ITM_STIM_PORT((x))) #define ITM_STIM_PORT_32(x)(*(volatile uint32_t *) ITM_STIM_PORT((x)))void ITM_initModule(const ITM_config itm_config) {// Disable moduleSCS_DEMCR &= (~SCS_DEMCR_TRCEN);ITM_TCR= 0x00000000;// Enable traceSCS_DEMCR |= SCS_DEMCR_TRCEN;// Unlock and Setup TPIU for SWO UART modeTPIU_LAR= CS_LAR_UNLOCK;TPIU_SPPR= TPIU_SPPR_SWO_UART;TPIU_CSPSR = TPIU_CSPSR_PIN_1;// Unlock and enable all ITM stimulus ports with default settingsITM_LAR= CS_LAR_UNLOCK;ITM_TER= ITM_TER_ENABLE_ALL;ITM_TPR= ITM_TPR_ENABLE_USER_ALL;// Setup Baud rateif (itm_config.systemClock){uint32_t prescalar = itm_config.systemClock / itm_config.baudRate;// Offset with current prescalar valueuint32_t diff1 = itm_config.systemClock - (prescalar * itm_config.baudRate);// Offset with prescalar+1 valueuint32_t diff2 = ((prescalar+1) * itm_config.baudRate) - itm_config.systemClock;if (diff2 < diff1)prescalar++;// Program prescalar value as (prescalar factor - 1)TPIU_ACPR = (prescalar - 1);}// Disable formatterTPIU_FFCR= 0;// Unlock DWTDWT_LAR= CS_LAR_UNLOCK;// Configure SWO TracesIOCPortConfigureSet(IOID_18, IOC_PORT_MCU_SWV, IOC_STD_OUTPUT);}void ITM_enableModule() {// Enable ITM moduleITM_TCR |= ITM_TCR_ENABLE_ITM; }void ITM_disableModule() {// Disable ITM moduleITM_TCR &= ~ITM_TCR_ENABLE_ITM; }void ITM_putStringBlocking(const char* msg, const uint8_t port) {// Write one character at a time.while('\0' != *msg){while(0 == ITM_STIM_PORT_8(port));ITM_STIM_PORT_8(port) = *msg++;} }void ITM_putValueBlocking(uint32_t value, const uint8_t port) {char strValue[8];int8_t digitIdx;bool putStarted = false;for(digitIdx = 7; digitIdx >= 0; digitIdx--){strValue[digitIdx] = (value & (0xF << digitIdx * 4)) >> (digitIdx*4);if(strValue[digitIdx] < 10){strValue[digitIdx] += '0';}else{strValue[digitIdx] += 'a'-10;}if( (strValue[digitIdx] != '0') || putStarted ){while(0 == ITM_STIM_PORT_8(port));ITM_STIM_PORT_8(port) = strValue[digitIdx];putStarted = true;}} }void ITM_putNewLineBlocking(const uint8_t port) {while(0 == ITM_STIM_PORT_8(port));ITM_STIM_PORT_8(port) = '\n'; }void ITM_putWordBlocking(const uint32_t data, const uint8_t port) {// Write the entire32-bit valuewhile(0 == ITM_STIM_PORT_32(port));ITM_STIM_PORT_32(port) = data; }void ITM_enableExceptionTrace() {DWT_CTRL |= DWT_CTRL_ENABLE_EXC_TRC;ITM_TCR|= ITM_TCR_ENABLE_DWT_TX; }void ITM_enablePCSampling() {// Clear the PC Sampling and Cycle Event bitsDWT_CTRL &= ~(DWT_CTRL_ENABLE_PC_SAMP | DWT_CTRL_ENABLE_CYC_EVT);// Setup Sampling intervalDWT_CTRL |= DWT_CTRL_CYC_CNT_1024;ITM_TCR|= ITM_TCR_ENABLE_DWT_TX;DWT_CTRL |= DWT_CTRL_ENABLE_CYC_CNT;// Enable PC sampling eventDWT_CTRL |= DWT_CTRL_ENABLE_PC_SAMP; }bool ITM_enableDataTrace(const uint32_t *variable) {uint_least8_t numDwtComp = (DWT_CTRL & DWT_CTRL_MASK_NUM_COMP) >> DWT_CTRL_SHIFT_NUM_COMP;uint_least8_t dwtIndex = 0;bool dwtAvailable = false;for (dwtIndex = 0; dwtIndex < numDwtComp ; dwtIndex++){if (0 == DWT_FUNC(dwtIndex)){DWT_COMP(dwtIndex) = (uint32_t)variable;DWT_MASK(dwtIndex) = 0x0;DWT_FUNC(dwtIndex) = (DWT_FUNC_DATA_SIZE_32 | DWT_FUNC_ENABLE_ADDR_OFFSET | DWT_FUNC_ENABLE_COMP_RW);dwtAvailable = true;}}return dwtAvailable; }void ITM_enableCycleCounter() {// Clear the PC Sampling and Cycle Event bitsDWT_CTRL &= ~(DWT_CTRL_ENABLE_PC_SAMP | DWT_CTRL_ENABLE_CYC_EVT);// Setup Sampling intervalDWT_CTRL |= DWT_CTRL_CYC_CNT_1024;ITM_TCR|= ITM_TCR_ENABLE_DWT_TX;DWT_CTRL |= DWT_CTRL_ENABLE_CYC_CNT;// Enable Cycle Count eventDWT_CTRL |= DWT_CTRL_ENABLE_CYC_EVT; }void ITM_enableTiming(ITM_tsPrescale tsPrescale) {// Set timestamp prescalar enable timestamp generationITM_TCR|= ((tsPrescale << ITM_TCR_TS_PRESCALE_SHIFT) & ITM_TCR_TS_PRESCALE_MASK);ITM_TCR|= (ITM_TCR_ENABLE_TS); }void ITM_enableSyncPackets(ITM_syncPacketRate syncPacketRate) {// Clear sync packet rateDWT_CTRL &= ~(DWT_CTRL_MASK_SYNCTAP);// Set sync packet rateDWT_CTRL |= ((syncPacketRate << DWT_CTRL_SHIFT_SYNCTAP) & DWT_CTRL_MASK_SYNCTAP);// Enable sync packet generationDWT_CTRL |= DWT_CTRL_ENABLE_CYC_CNT;ITM_TCR|= (ITM_TCR_ENABLE_SYNC); }void ITM_getLibraryVersion(uint32_t *majorVersion, uint32_t *minorVersion) {if (majorVersion && minorVersion){*majorVersion = ITM_LIB_MAJOR_VER;*minorVersion = ITM_LIB_MINOR_VER;} }void ITM_flushModule() {// Wait till the ITM Busy status has been clearedwhile (ITM_TCR & ITM_TCR_BUSY){asm (" NOP");} }itm.h
C:\ti\simplelink_cc13x0_sdk_4_20_02_07__win\simplelink_cc13x0_sdk_4_20_02_07\source\ti\ti154stack\tracer
在cc1310的文件目录下,只有dbg.c,并没有swo相关的内容。
,
Alex Zhang:
另外我给您找到了相关的链接,希望对您有帮助,您仔细查看一下:
https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/525815/is-there-an-swo-like-output-on-the-cc26xx?tisearch=e2e-sitesearch&keymatch=swo
https://e2e.ti.com/support/wireless-connectivity/other-wireless-group/other-wireless/f/other-wireless-technologies-forum/1183338/launchxl-cc1350-4-swo-trace-not-enabling-correctly?tisearch=e2e-sitesearch&keymatch=SWO
,