2015-10-09 01:37 PM
2015-10-09 01:49 PM
Look at the two CAN_ESR registers to determine the error. Do you have twisted pair between both nodes, and 120 ohm termination at each end?
Jack Peacock2015-10-09 01:59 PM
First, thank you peacock.jack.003 for fast reply. Yep. I used 120 ohm resistor between can_H and can_L. In addition, USART6 can't run. No data doesn't appear. I use 2 x MCP2551 for Can1 and Can2 node.
2015-10-09 03:36 PM
You'd need to have code to associate the USART6 with the STDIO functionality.
//******************************************************************************
// Hosting of stdio functionality through USART6
//******************************************************************************
#include <
rt_misc.h
>
#pragma import(__use_no_semihosting_swi)
struct __FILE { int handle; /* Add whatever you need here */ };
FILE __stdout;
FILE __stdin;
int fputc(int ch, FILE *f)
{
while(USART_GetFlagStatus(USART6, USART_FLAG_TXE) == RESET);
USART_SendData(USART6, ch);
return(ch);
}
int fgetc(FILE *f)
{
char ch;
while(USART_GetFlagStatus(USART6, USART_FLAG_RXNE) == RESET);
ch = USART_ReceiveData(USART6);
return((int)ch);
}
int ferror(FILE *f)
{
/* Your implementation of ferror */
return EOF;
}
void _ttywrch(int ch)
{
while(USART_GetFlagStatus(USART6, USART_FLAG_TXE) == RESET);
USART_SendData(USART6, ch);
}
void _sys_exit(int return_code)
{
label: goto label; /* endless loop */
}
2015-10-10 01:03 AM
Thank you clive1, How do I associate this code with STDIO functionatily? Where do I add this code?
2015-10-10 07:38 AM
Where do I add this code?
Anywhere in your project. The system has no knowledge of how the data gets to the serial port unless you provide a route, in the manner provided here. Please review Keil documentation for more background http://www.keil.com/support/man/docs/gsac/gsac_retargetcortex.htm2015-10-10 11:16 AM
Thanks clive1. I will read that one. I added that code block in the main program. But, This code can't work still. I used USART2, When i push reset button, meaningless character view in my serialport Program. I show you my schematic.
Schematic diagram : http://i57.tinypic.com/x0ra5j.jpg2015-10-10 05:55 PM
Make sure HSE_VALUE is correctly define as 8000000 in you project (often stm32f4xx_conf.h) and the PLL settings assume an 8 MHz source.
Get you serial port output working so you have some chance of debugging/diagnosing your issues. Circuit does not appear unreasonable.2015-10-11 12:58 AM
I defined HSE_VALUE=8000000 in the Options for target-> C/C++. But it can't work. I will try with logic analyzer. I ordered it. I will share result here. Thanks clive1..