mirror of
https://gitee.com/moluo-tech/CodeBrick.git
synced 2025-01-30 04:42:53 +08:00
解决tty未初始化串口的问题
This commit is contained in:
parent
b40bd16446
commit
6bb9546232
@ -18,11 +18,13 @@
|
||||
|
||||
/*<2A>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD> --------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
void (*init)(int baudrate);
|
||||
void (*init)(int baudrate);
|
||||
unsigned int (*write)(const void *buf, unsigned int len);
|
||||
unsigned int (*read)(void *buf, unsigned int len);
|
||||
unsigned int (*read)(void *buf, unsigned int len);
|
||||
bool (*tx_isfull)(void); /*<2A><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
bool (*rx_isempty)(void); /*<2A><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
}tty_t;
|
||||
|
||||
extern const tty_t tty;
|
||||
extern const tty_t tty;
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
static unsigned char rxbuf[TTY_RXBUF_SIZE]; /*<2A><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD> */
|
||||
static unsigned char txbuf[TTY_TXBUF_SIZE]; /*<2A><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> */
|
||||
static ring_buf_t rbuf_send, rbuf_recv; /*<2A>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
static ring_buf_t rbsend, rbrecv; /*<2A>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
|
||||
/*
|
||||
* @brief <EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD>
|
||||
@ -35,8 +35,20 @@ static ring_buf_t rbuf_send, rbuf_recv; /*
|
||||
*/
|
||||
static void uart_init(int baudrate)
|
||||
{
|
||||
ring_buf_init(&rbuf_send, txbuf, sizeof(txbuf));/*<2A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD> */
|
||||
ring_buf_init(&rbuf_recv, rxbuf, sizeof(rxbuf));
|
||||
ring_buf_init(&rbsend, txbuf, sizeof(txbuf));/*<2A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD> */
|
||||
ring_buf_init(&rbrecv, rxbuf, sizeof(rxbuf));
|
||||
|
||||
GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_USART1);
|
||||
GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_USART1);
|
||||
|
||||
gpio_conf(GPIOA, GPIO_Mode_AF, GPIO_PuPd_NOPULL,
|
||||
GPIO_Pin_9 | GPIO_Pin_10);
|
||||
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
|
||||
uart_conf(USART1, baudrate); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
|
||||
nvic_conf(USART1_IRQn, 1, 1);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -48,10 +60,11 @@ static void uart_init(int baudrate)
|
||||
static unsigned int uart_write(const void *buf, unsigned int len)
|
||||
{
|
||||
unsigned int ret;
|
||||
ret = ring_buf_put(&rbuf_send, (unsigned char *)buf, len);
|
||||
ret = ring_buf_put(&rbsend, (unsigned char *)buf, len);
|
||||
USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @param[in] buf - <EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD>
|
||||
@ -61,15 +74,28 @@ static unsigned int uart_write(const void *buf, unsigned int len)
|
||||
*/
|
||||
static unsigned int uart_read(void *buf, unsigned int len)
|
||||
{
|
||||
return ring_buf_get(&rbuf_recv, (unsigned char *)buf, len);
|
||||
return ring_buf_get(&rbrecv, (unsigned char *)buf, len);
|
||||
}
|
||||
|
||||
/*<2A><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
static bool tx_isfull(void)
|
||||
{
|
||||
return ring_buf_len(&rbsend) == TTY_TXBUF_SIZE;
|
||||
}
|
||||
|
||||
/*<2A><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
bool rx_isempty(void)
|
||||
{
|
||||
return ring_buf_len(&rbrecv) == 0;
|
||||
}
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD>̨<EFBFBD>ӿڶ<D3BF><DAB6><EFBFBD> -------------------------------------------------------------*/
|
||||
const tty_t tty =
|
||||
{
|
||||
const tty_t tty = {
|
||||
uart_init,
|
||||
uart_write,
|
||||
uart_read
|
||||
uart_read,
|
||||
tx_isfull,
|
||||
rx_isempty
|
||||
};
|
||||
|
||||
/*
|
||||
@ -82,10 +108,10 @@ void USART1_IRQHandler(void)
|
||||
unsigned char data;
|
||||
if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) {
|
||||
data = USART_ReceiveData(USART1);
|
||||
ring_buf_put(&rbuf_recv, &data, 1); /*<2A><><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
ring_buf_put(&rbrecv, &data, 1); /*<2A><><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
}
|
||||
if (USART_GetITStatus(USART1, USART_IT_TXE) != RESET) {
|
||||
if (ring_buf_get(&rbuf_send, &data, 1)) /*<2A>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---*/
|
||||
if (ring_buf_get(&rbsend, &data, 1)) /*<2A>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---*/
|
||||
USART_SendData(USART1, data);
|
||||
else{
|
||||
USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
|
||||
@ -93,5 +119,5 @@ void USART1_IRQHandler(void)
|
||||
}
|
||||
if (USART_GetITStatus(USART1, USART_IT_ORE_RX) != RESET) {
|
||||
data = USART_ReceiveData(USART1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>MemFile</name>
|
||||
<state></state>
|
||||
<state>$TOOLKIT_DIR$\CONFIG\debugger\ST\STM32F405VG.ddf</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>RunToEnable</name>
|
||||
@ -77,7 +77,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>OCDownloadVerifyAll</name>
|
||||
<state>0</state>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>OCProductVersion</name>
|
||||
@ -85,7 +85,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>OCDynDriverList</name>
|
||||
<state>ARMSIM_ID</state>
|
||||
<state>STLINK_ID</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>OCLastSavedByProductVersion</name>
|
||||
@ -97,7 +97,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>UseFlashLoader</name>
|
||||
<state>0</state>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CLowLevel</name>
|
||||
@ -117,7 +117,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>FlashLoadersV3</name>
|
||||
<state>$TOOLKIT_DIR$\config\flashloader\</state>
|
||||
<state>$TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32F4xxx.board</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>OCImagesSuppressCheck1</name>
|
||||
@ -603,7 +603,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>IjetCpuClockEdit</name>
|
||||
<state>72.0</state>
|
||||
<state>168.0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>IjetSwoPrescalerList</name>
|
||||
@ -853,7 +853,7 @@
|
||||
<option>
|
||||
<name>CCJLinkResetList</name>
|
||||
<version>6</version>
|
||||
<state>5</state>
|
||||
<state>7</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CCJLinkInterfaceCmdLine</name>
|
||||
@ -1202,7 +1202,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>CCSTLinkInterfaceRadio</name>
|
||||
<state>0</state>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CCSTLinkInterfaceCmdLine</name>
|
||||
|
@ -703,7 +703,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>IlinkMapFile</name>
|
||||
<state>0</state>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>IlinkLogFile</name>
|
||||
|
164
mdk/JLinkLog.txt
164
mdk/JLinkLog.txt
@ -1,65 +1,111 @@
|
||||
|
||||
T2A74 000:280 SEGGER J-Link V4.68a Log File (0001ms, 0138ms total)
|
||||
T2A74 000:280 DLL Compiled: Apr 12 2013 13:26:50 (0001ms, 0138ms total)
|
||||
T2A74 000:280 Logging started @ 2020-07-11 09:46 (0001ms, 0138ms total)
|
||||
T2A74 000:281 JLINK_SetWarnOutHandler(...) (0000ms, 0138ms total)
|
||||
T2A74 000:281 JLINK_OpenEx(...)
|
||||
T1BD8 000:301 SEGGER J-Link V4.68a Log File (0001ms, 0154ms total)
|
||||
T1BD8 000:301 DLL Compiled: Apr 12 2013 13:26:50 (0001ms, 0154ms total)
|
||||
T1BD8 000:301 Logging started @ 2020-07-11 10:25 (0001ms, 0154ms total)
|
||||
T1BD8 000:302 JLINK_SetWarnOutHandler(...) (0000ms, 0154ms total)
|
||||
T1BD8 000:302 JLINK_OpenEx(...)
|
||||
Firmware: J-Link ARM V8 compiled Dec 1 2015 11:42:48
|
||||
Hardware: V8.00
|
||||
S/N: 20080643
|
||||
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull returns O.K. (0011ms, 0149ms total)
|
||||
T2A74 000:292 JLINK_SetErrorOutHandler(...) (0000ms, 0149ms total)
|
||||
T2A74 000:292 JLINK_ExecCommand("ProjectFile = "G:\Design\workspace\develop\gitee\CodeBrick\MDK\JLinkSettings.ini"", ...) returns 0x00 (0006ms, 0155ms total)
|
||||
T2A74 000:298 JLINK_ExecCommand("Device = STM32F405RG", ...)
|
||||
JLINK_AddMirrorAreaEx(Addr = 0x00000000, Size = 0x00000000) (0001ms, 0001ms total)
|
||||
Device "STM32F405RG" selected (1024 KB flash, 128 KB RAM). returns 0x00 (0002ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_ExecCommand("DisableConnectionTimeout", ...) returns 0x00 (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_GetDLLVersion() returns 46801 (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_GetFirmwareString(...) (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_GetDLLVersion() returns 46801 (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_GetCompileDateTime() (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_GetFirmwareString(...) (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_TIF_Select(JLINKARM_TIF_JTAG) returns 0x00 (0000ms, 0158ms total)
|
||||
T2A74 000:301 JLINK_SetSpeed(2000) (0000ms, 0158ms total)
|
||||
T2A74 000:302 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL) returns JLINKARM_RESET_TYPE_NORMAL (0000ms, 0158ms total)
|
||||
T2A74 000:302 JLINK_Reset()
|
||||
***** Error: Supply voltage too low (1 Volt is required, Measured: 0.0 Volt).
|
||||
Please check target power.STM32F2xxx/STM32F4xxx: Can not attach to CPU. Trying connect under reset.RESET (pin 15) high, but should be low. Please check target hardware.JLINK_GetIdData(...) (0000ms, 0460ms total)
|
||||
T2A74 000:604 JLINK_GetIdData(...) (0000ms, 0460ms total)
|
||||
T2A74 000:610 JLINK_GetFirmwareString(...) (0000ms, 0460ms total)
|
||||
T2A74 009:246 JLINK_IsOpen() returns 0x01 (0000ms, 0460ms total)
|
||||
T2A74 009:246 JLINK_Close() (0010ms, 0470ms total)
|
||||
T2A74 009:257 JLINK_SelectUSB(Port = 0) returns 0x00 (0000ms, 0471ms total)
|
||||
T2A74 009:257 JLINK_EnableLog(...) (0000ms, 0471ms total)
|
||||
T2A74 009:257 JLINK_SetWarnOutHandler(...) (0000ms, 0471ms total)
|
||||
T2A74 009:257 JLINK_OpenEx(...)
|
||||
Firmware: J-Link ARM V8 compiled Dec 1 2015 11:42:48
|
||||
Hardware: V8.00
|
||||
S/N: 20080643
|
||||
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull returns O.K. (0007ms, 0478ms total)
|
||||
T2A74 009:264 JLINK_SetErrorOutHandler(...) (0000ms, 0478ms total)
|
||||
T2A74 009:264 JLINK_ExecCommand("ProjectFile = "G:\Design\workspace\develop\gitee\CodeBrick\MDK\JLinkSettings.ini"", ...) returns 0x00 (0000ms, 0478ms total)
|
||||
T2A74 009:264 JLINK_ExecCommand("Device = STM32F405RG", ...)
|
||||
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull returns O.K. (0007ms, 0161ms total)
|
||||
T1BD8 000:309 JLINK_SetErrorOutHandler(...) (0000ms, 0161ms total)
|
||||
T1BD8 000:309 JLINK_ExecCommand("ProjectFile = "G:\Design\workspace\develop\gitee\CodeBrick\mdk\JLinkSettings.ini"", ...) returns 0x00 (0000ms, 0161ms total)
|
||||
T1BD8 000:309 JLINK_ExecCommand("Device = STM32F405RG", ...)
|
||||
JLINK_AddMirrorAreaEx(Addr = 0x00000000, Size = 0x00000000) (0000ms, 0000ms total)
|
||||
Device "STM32F405RG" selected (1024 KB flash, 128 KB RAM). returns 0x00 (0002ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_ExecCommand("DisableConnectionTimeout", ...) returns 0x00 (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_GetDLLVersion() returns 46801 (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_GetFirmwareString(...) (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_GetDLLVersion() returns 46801 (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_GetCompileDateTime() (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_GetFirmwareString(...) (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_TIF_Select(JLINKARM_TIF_SWD) returns 0x00 (0000ms, 0480ms total)
|
||||
T2A74 009:266 JLINK_SetSpeed(2000) (0001ms, 0481ms total)
|
||||
T2A74 009:267 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL) returns JLINKARM_RESET_TYPE_NORMAL (0000ms, 0481ms total)
|
||||
T2A74 009:267 JLINK_Reset()
|
||||
Device "STM32F405RG" selected (1024 KB flash, 128 KB RAM). returns 0x00 (0001ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_ExecCommand("DisableConnectionTimeout", ...) returns 0x00 (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_GetDLLVersion() returns 46801 (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_GetFirmwareString(...) (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_GetDLLVersion() returns 46801 (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_GetCompileDateTime() (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_GetFirmwareString(...) (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_TIF_Select(JLINKARM_TIF_JTAG) returns 0x00 (0000ms, 0162ms total)
|
||||
T1BD8 000:310 JLINK_SetSpeed(2000) (0000ms, 0162ms total)
|
||||
T1BD8 000:311 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL) returns JLINKARM_RESET_TYPE_NORMAL (0000ms, 0162ms total)
|
||||
T1BD8 000:311 JLINK_Reset()
|
||||
***** Error: Supply voltage too low (1 Volt is required, Measured: 0.0 Volt).
|
||||
Please check target power.STM32F2xxx/STM32F4xxx: Can not attach to CPU. Trying connect under reset.RESET (pin 15) high, but should be low. Please check target hardware.JLINK_GetId() returns 0x00000000 (0000ms, 0884ms total)
|
||||
T2A74 009:670 JLINK_GetId() returns 0x00000000 (0000ms, 0884ms total)
|
||||
T2A74 009:672 JLINK_GetFirmwareString(...) (0000ms, 0884ms total)
|
||||
T2A74 011:542 JLINK_Close() (0009ms, 0893ms total)
|
||||
T2A74 011:552 JLINK_Close() (0000ms, 0893ms total)
|
||||
T2A74 011:552 JLINK_Close() (0000ms, 0893ms total)
|
||||
Please check target power.STM32F2xxx/STM32F4xxx: Can not attach to CPU. Trying connect under reset.RESET (pin 15) high, but should be low. Please check target hardware.JLINK_GetIdData(...) (0000ms, 0465ms total)
|
||||
T1BD8 000:614 JLINK_GetIdData(...) (0000ms, 0465ms total)
|
||||
T1BD8 000:620 JLINK_GetFirmwareString(...) (0000ms, 0465ms total)
|
||||
T1BD8 005:687 JLINK_IsOpen() returns 0x01 (0000ms, 0465ms total)
|
||||
T1BD8 005:687 JLINK_Close() (0011ms, 0476ms total)
|
||||
T1BD8 005:699 JLINK_SelectUSB(Port = 0) returns 0x00 (0000ms, 0476ms total)
|
||||
T1BD8 005:699 JLINK_EnableLog(...) (0000ms, 0476ms total)
|
||||
T1BD8 005:699 JLINK_SetWarnOutHandler(...) (0000ms, 0476ms total)
|
||||
T1BD8 005:699 JLINK_OpenEx(...)
|
||||
Firmware: J-Link ARM V8 compiled Dec 1 2015 11:42:48
|
||||
Hardware: V8.00
|
||||
S/N: 20080643
|
||||
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull returns O.K. (0008ms, 0484ms total)
|
||||
T1BD8 005:707 JLINK_SetErrorOutHandler(...) (0000ms, 0484ms total)
|
||||
T1BD8 005:707 JLINK_ExecCommand("ProjectFile = "G:\Design\workspace\develop\gitee\CodeBrick\mdk\JLinkSettings.ini"", ...) returns 0x00 (0000ms, 0484ms total)
|
||||
T1BD8 005:707 JLINK_ExecCommand("Device = STM32F405RG", ...)
|
||||
JLINK_AddMirrorAreaEx(Addr = 0x00000000, Size = 0x00000000) (0000ms, 0000ms total)
|
||||
Device "STM32F405RG" selected (1024 KB flash, 128 KB RAM). returns 0x00 (0002ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_ExecCommand("DisableConnectionTimeout", ...) returns 0x00 (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_GetDLLVersion() returns 46801 (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_GetFirmwareString(...) (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_GetDLLVersion() returns 46801 (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_GetCompileDateTime() (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_GetFirmwareString(...) (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_TIF_Select(JLINKARM_TIF_SWD) returns 0x00 (0000ms, 0486ms total)
|
||||
T1BD8 005:709 JLINK_SetSpeed(2000) (0001ms, 0487ms total)
|
||||
T1BD8 005:710 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL) returns JLINKARM_RESET_TYPE_NORMAL (0000ms, 0487ms total)
|
||||
T1BD8 005:710 JLINK_Reset()
|
||||
***** Error: Supply voltage too low (1 Volt is required, Measured: 0.0 Volt).
|
||||
Please check target power.STM32F2xxx/STM32F4xxx: Can not attach to CPU. Trying connect under reset.RESET (pin 15) high, but should be low. Please check target hardware.JLINK_GetId() returns 0x00000000 (0000ms, 0890ms total)
|
||||
T1BD8 006:113 JLINK_GetId() returns 0x00000000 (0000ms, 0890ms total)
|
||||
T1BD8 006:114 JLINK_GetFirmwareString(...) (0000ms, 0890ms total)
|
||||
T1BD8 006:727 JLINK_GetDeviceFamily() returns 0 (0000ms, 0890ms total)
|
||||
T1BD8 006:727 JLINK_GetDebugInfo(0x100) returns 0xFFFFFFFF (0000ms, 0890ms total)
|
||||
T1BD8 006:727 JLINK_ReadMem (0xE00FFFF0, 0x0010 Bytes, ...) returns 0x01 (0000ms, 0890ms total)
|
||||
T1BD8 006:727 JLINK_ReadMem (0xE00FFFD0, 0x0020 Bytes, ...) returns 0x01 (0000ms, 0890ms total)
|
||||
T1BD8 013:325 JLINK_SetSpeed(10000) (0000ms, 0890ms total)
|
||||
T1BD8 013:325 JLINK_Close() (0009ms, 0899ms total)
|
||||
T1BD8 013:337 JLINK_IsOpen() returns 0x00 (0000ms, 0899ms total)
|
||||
T1BD8 013:337 JLINK_EMU_GetList(InterfaceMask = 0x00000001, MaxInfos = 0x00000004) [0]: USB, S/N: 123456 returns 0x01 (0000ms, 0899ms total)
|
||||
T1BD8 013:337 JLINK_Close() (0000ms, 0899ms total)
|
||||
T1BD8 013:338 JLINK_SelectUSB(Port = 0) returns 0x00 (0000ms, 0899ms total)
|
||||
T1BD8 013:338 JLINK_OpenEx(...)
|
||||
Firmware: J-Link ARM V8 compiled Dec 1 2015 11:42:48
|
||||
Hardware: V8.00
|
||||
S/N: 20080643
|
||||
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull returns O.K. (0008ms, 0907ms total)
|
||||
T1BD8 013:346 JLINK_TIF_GetAvailable(...) (0000ms, 0907ms total)
|
||||
T1BD8 013:346 JLINK_GetEmuCaps() returns 0xB9FF7BBF (0000ms, 0907ms total)
|
||||
T1BD8 013:346 JLINK_IsOpen() returns 0x01 (0000ms, 0907ms total)
|
||||
T1BD8 013:346 JLINK_Close() (0023ms, 0930ms total)
|
||||
T1BD8 013:369 JLINK_SelectUSB(Port = 0) returns 0x00 (0000ms, 0930ms total)
|
||||
T1BD8 013:369 JLINK_EnableLog(...) (0000ms, 0930ms total)
|
||||
T1BD8 013:369 JLINK_SetWarnOutHandler(...) (0000ms, 0930ms total)
|
||||
T1BD8 013:369 JLINK_OpenEx(...)
|
||||
Firmware: J-Link ARM V8 compiled Dec 1 2015 11:42:48
|
||||
Hardware: V8.00
|
||||
S/N: 20080643
|
||||
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull returns O.K. (0009ms, 0939ms total)
|
||||
T1BD8 013:378 JLINK_SetErrorOutHandler(...) (0000ms, 0939ms total)
|
||||
T1BD8 013:378 JLINK_ExecCommand("ProjectFile = "G:\Design\workspace\develop\gitee\CodeBrick\mdk\JLinkSettings.ini"", ...) returns 0x00 (0000ms, 0939ms total)
|
||||
T1BD8 013:378 JLINK_ExecCommand("Device = STM32F405RG", ...)
|
||||
JLINK_AddMirrorAreaEx(Addr = 0x00000000, Size = 0x00000000) (0000ms, 0000ms total)
|
||||
Device "STM32F405RG" selected (1024 KB flash, 128 KB RAM). returns 0x00 (0001ms, 0940ms total)
|
||||
T1BD8 013:379 JLINK_ExecCommand("DisableConnectionTimeout", ...) returns 0x00 (0000ms, 0940ms total)
|
||||
T1BD8 013:379 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0940ms total)
|
||||
T1BD8 013:379 JLINK_GetDLLVersion() returns 46801 (0001ms, 0941ms total)
|
||||
T1BD8 013:380 JLINK_GetFirmwareString(...) (0000ms, 0941ms total)
|
||||
T1BD8 013:380 JLINK_GetDLLVersion() returns 46801 (0000ms, 0941ms total)
|
||||
T1BD8 013:380 JLINK_GetCompileDateTime() (0000ms, 0941ms total)
|
||||
T1BD8 013:380 JLINK_GetFirmwareString(...) (0000ms, 0941ms total)
|
||||
T1BD8 013:380 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 0941ms total)
|
||||
T1BD8 013:380 JLINK_TIF_Select(JLINKARM_TIF_SWD) returns 0x00 (0000ms, 0941ms total)
|
||||
T1BD8 013:380 JLINK_SetSpeed(50) (0000ms, 0941ms total)
|
||||
T1BD8 013:381 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL) returns JLINKARM_RESET_TYPE_NORMAL (0000ms, 0941ms total)
|
||||
T1BD8 013:381 JLINK_Reset()STM32F2xxx/STM32F4xxx: Can not attach to CPU. Trying connect under reset.RESET (pin 15) high, but should be low. Please check target hardware.JLINK_GetId() returns 0x00000000 (0000ms, 1345ms total)
|
||||
T1BD8 013:785 JLINK_GetId() returns 0x00000000 (0000ms, 1345ms total)
|
||||
T1BD8 013:789 JLINK_GetFirmwareString(...) (0000ms, 1345ms total)
|
||||
T1BD8 015:778 JLINK_Close() (0011ms, 1356ms total)
|
||||
T1BD8 015:789 JLINK_Close() (0000ms, 1356ms total)
|
||||
T1BD8 015:789 JLINK_Close() (0000ms, 1356ms total)
|
||||
|
@ -10,8 +10,8 @@
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
#define SW_VER "1.00"
|
||||
#define HW_VER "1.00"
|
||||
#define APP_ADDRESS 0x08004000 //Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ַ
|
||||
|
||||
#define SW_VER "1.00" //<2F><><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE>
|
||||
|
||||
#endif
|
@ -8,7 +8,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
******************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "module.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@ -17,8 +17,10 @@
|
||||
* @return none
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
{
|
||||
//NVIC_SetVectorTable(NVIC_VectTab_FLASH, APP_ADDRESS);
|
||||
module_task_init(); /*ģ<><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>*/
|
||||
printf("software version:%s\r\n", SW_VER);
|
||||
while (1) {
|
||||
module_task_process(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ*/
|
||||
}
|
||||
|
@ -8,33 +8,44 @@
|
||||
******************************************************************************/
|
||||
#include "module.h"
|
||||
#include "public.h"
|
||||
#include "config.h"
|
||||
#include "platform.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "tty.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* @brief ϵͳ<EFBFBD>δ<EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
* @param[in] none
|
||||
* @return none
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* @brief ϵͳ<EFBFBD>δ<EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
* @param[in] none
|
||||
* @return none
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
systick_increase(SYS_TICK_INTERVAL);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @brief Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
||||
* @param[in] none
|
||||
* @return none
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* @brief <EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD>printf
|
||||
*/
|
||||
int putchar(int c)
|
||||
{
|
||||
tty.write(&c, 1);
|
||||
while (tty.tx_isfull()) {} //<2F><>ֹ<EFBFBD><D6B9>LOG
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
||||
* @param[in] none
|
||||
* @return none
|
||||
*/
|
||||
static void bsp_init(void)
|
||||
{
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD> --------*/
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
|
||||
tty.init(115200);
|
||||
SystemCoreClockUpdate();
|
||||
SysTick_Config(SystemCoreClock / SYS_TICK_INTERVAL);
|
||||
NVIC_SetPriority(SysTick_IRQn, 0); // Set SysTick IRQ priority
|
||||
SysTick_Config(SystemCoreClock / SYS_TICK_INTERVAL); //<2F><><EFBFBD><EFBFBD>ϵͳʱ<CDB3><CAB1>
|
||||
NVIC_SetPriority(SysTick_IRQn, 0);
|
||||
|
||||
}system_init("bsp", bsp_init);
|
||||
|
@ -15,11 +15,11 @@
|
||||
* @brief GPIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @return none
|
||||
*/
|
||||
void gpio_conf(GPIO_TypeDef* GPIOx, GPIOMode_TypeDef Mode,GPIOPuPd_TypeDef PuPd,
|
||||
void gpio_conf(GPIO_TypeDef* GPIOx, GPIOMode_TypeDef Mode, GPIOPuPd_TypeDef PuPd,
|
||||
uint32_t Pins)
|
||||
{
|
||||
uint32_t clock;
|
||||
GPIO_InitTypeDef config = {0};
|
||||
GPIO_InitTypeDef config;
|
||||
config.GPIO_Pin = Pins;
|
||||
config.GPIO_Mode = Mode;
|
||||
config.GPIO_OType = GPIO_OType_PP;
|
||||
@ -125,5 +125,8 @@ void uart_conf(USART_TypeDef *port, int baudrate)
|
||||
config.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
config.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
USART_Init(port, &config);
|
||||
USART_ITConfig(port, USART_IT_RXNE, ENABLE);
|
||||
USART_ITConfig(port, USART_IT_ERR, ENABLE);
|
||||
USART_Cmd(port, ENABLE);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user