2968 views|1 replies

2015

Posts

0

Resources
The OP
 

dsp6657 serial port learning [Copy link]

1. I plan to learn with dsp6657, so let's experiment with the serial port first. Find the chip support libraries, path D:\ti\pdk_C6657_1_1_1_4\packages\ti\csl, create a new project 2. Didn't find the C library file for the serial port in this directory? I can only go to other projects to see why. Indeed, other projects use these two initializations. 1 platform_uart_init(); 2 platform_uart_set_baudrate(19200); 3. DSP6657 has 2 serial ports, supporting optional flow control 4. Get the path of the header file and the library path D:\ti\pdk_C6657_1_1_1_4\packages\ti\platform\evmc6657l\platform_lib\lib\debug\ti.platform.evm6657l.lite.lib. Now I really want to know how to change it to a relative path. I wrote a simple program to test it first. Copy code 1 #include "cslr_uart.h" 2 //It is estimated that after importing the package, you can directly use the included path 3 #include "ti/platform/platform.h" 4 5 //#define PLATFORM_WRITE_IN 1 6 void delay(int j) 7 { 8 int i = 50000; 9 while(j--) 10 { 11 int i = 50000; 12 while(i--); 13 } 14 } 15 void main() 16 { 17 int i; 18 platform_init_flags sFlags; 19 platform_init_config sConfig;[ /size] 20 /* Status of the call to initialize the platform */ 21 Int32 pform_status; 22 /* Platform Information - we will read it form the Platform Library */ 23 platform_info sPlatformInfo; 24 25 /* [size=4 ]26 * You can choose what to initialize on the platform by setting the following 27 * flags. We will initialize everything. 28 */ 29 memset( (void *) &sFlags, 0, sizeof(platform_init_flags)); 30 memset( (void *) &sConfig, 0, sizeof(platform _init_config)); 31 32 sFlags.pll = 0; 33 sFlags.ddr = 0; 34 sFlags.tcsl = 0; /* Time stamp counter */ 35 sFlags.phy = 0; /* Ethernet */ 36 sFlags.ecc = 0; 37 38 sConfig.pllm = 0; 39 40 pform_status = platform_init(&sFlags, &sConfig); 41 if (pform_status == Platform_EOK ) { 42 /* Get information about the platform so we can use it in various places */ 43 memset( (void *) &sPlatformInfo, 0,sizeof(platform_info)); 44 (void) platform_get_info(&sPlatformInfo); 45 } 46 [ size=4]47 platform_uart_init(); 48 platform_uart_set_baudrate(19200); 49 //Serial port initialization 50 // Print a paragraph 51 while(1) 52 { 53 54 platform_uart_write(0x55 ); 55 (void) platform_led(1, PLATFORM_LED_ON, (LED_CLASS_E) PLATFORM_USER_LED_CLASS); 56 delay(50); 57 (void) platform_led(1, PLATFORM_LED_OFF, (LED_CLASS_E) PLATFORM_USER_LED_CLASS); [size= 4]58 delay(50); 59 } 60 } Copy code 5. I guess there is no cmd file, so the download program failed. But strangely, other 6657 projects do not have CMD files. C665x DSP integrates a lot of on-chip memory. In addition to the 32KB L1 program and data cache area, Each core has 1024KB of dedicated memory, which can be configured as mappable RAM or cache. The device also integrates 1024KB of multi-core shared memory, which can be used as a shared L2 SRAM or a shared L3 SRAM. All L2 memories have error detection and correction capabilities. This time, write to the L1 space and try it. If you want to trigger core1 to run , it should also be necessary for core0 to write IPC trigger to core1 after core0 is running. 6. Create a CMD file to test it Copy code 1 /* 2 * Linker command file 3 * 4 */ [ size=4] 5 6 -c 7 -heap 0x41000 8 -stack 0xa000 [size= 4] 9 10 /* Memory Map 1 - the default */ 11 MEMORY 12 { [ size=4]13 L1PSRAM (RWX) : org = 0x0E00000, len = 0x7FFF 14 L1DSRAM (RWX) : org = 0x0F00000, len = 0x7FFF 15 [size= 4]16 L2SRAM (RWX) : org = 0x0800000, len = 0x080000 17 MSMCSRAM (RWX) : org = 0xc000000, len = 0x100000 18 DDR3 (RWX ): org = 0x80000000,len = 0x20000000 19 } 20 21 SECTIONS 22 { 23 .csl_vect > L2SRAM[/size ] 24 .text > L2SRAM 25 GROUP (NEAR_DP) 26 { 27 .neardata[/ size] 28 .rodata 29 .bss 30 } load > L2SRAM 31 .stack > L2SRAM 32 .cinit > L2SRAM 33 .cio > L2SRAM 34 .const > L2SRAM 35 .data > L2SRAM 36 .switch > L2SRAM 37 .sysmem > L2SRAM 38 .far > L2SRAM 39 .testMem > L2SRAM 40 .fardata > L2SRAM [size =4]41 platform_lib > L2SRAM 42 } Copy code 7. During the simulation test, it was found that the LED light would flash, but The serial port data is incorrect. I suspect the clock configuration is incorrect. 8.When testing, I thought it was a problem with the CFG file, so I added a CFG file (when adding, CCS will prompt whether to add RTSC to the project, I added it), but it was useless, so I deleted the CFG file, but CCS prompted that RTSC needed a .cfg file, so it seemed that I needed to delete RTSC as well. I couldn't figure it out, so I rebuilt a project and copied the previous C file and CMD file in. 9. The serial port baud rate is wrong, probably because of the system clock configuration problem, so there is no choice but to use a logic analyzer to capture the packet and take a look. In fact, there is data every time, because the baud rate was lowered before, there is garbled data. The figure below is the waveform of RS232, each bit is 520.5us, using 1000000/520.5 = 1923 baud rate. 10. Check the data received by the serial port. It is correct. Next, we need to study the clock configuration function of DSP6657. 11. Check the baud rate configuration function. The clock source is PLATFORM_UART_INPUT_CLOCK_RATE. However, the system clock is wrong, which is troublesome. Copy code 1 Platform_STATUS platform_uart_set_baudrate(uint32_t baudrate) { 2 uint16_t brate; 3 IFPRINT(platform_write("platform_uart_set_baudrate(baudrate=%d) called \n", baudrate) ); 4 brate = ((Uint16) (PLATFORM_UART_INPUT_CLOCK_RATE/(baudrate * 16))); 5 UartSetBaudRate(brate); 6 return Platform_EOK; 7 }

This post is from DSP and ARM Processors

Latest reply

I like your sharing, it is always so classic.  Details Published on 2019-4-22 07:58
 

2618

Posts

0

Resources
2
 
I like your sharing, it is always so classic.
This post is from DSP and ARM Processors
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list