Browse Source

board_460800

master
gudae 3 months ago
parent
commit
fc4b28867f
  1. BIN
      DefaultBuild/cstart.obj
  2. BIN
      DefaultBuild/delay.obj
  3. BIN
      DefaultBuild/dipSwitch.obj
  4. BIN
      DefaultBuild/gatectrl.obj
  5. BIN
      DefaultBuild/i2c.obj
  6. BIN
      DefaultBuild/multical.abs
  7. 588
      DefaultBuild/multical.map
  8. 2625
      DefaultBuild/multical.mot
  9. BIN
      DefaultBuild/owi.obj
  10. BIN
      DefaultBuild/r_cg_cgc.obj
  11. BIN
      DefaultBuild/r_cg_cgc_user.obj
  12. BIN
      DefaultBuild/r_cg_port.obj
  13. BIN
      DefaultBuild/r_cg_port_user.obj
  14. BIN
      DefaultBuild/r_cg_serial.obj
  15. BIN
      DefaultBuild/r_cg_serial_user.obj
  16. BIN
      DefaultBuild/r_main.obj
  17. BIN
      DefaultBuild/r_systeminit.obj
  18. BIN
      DefaultBuild/stkinit.obj
  19. BIN
      DefaultBuild/uart.obj
  20. 40
      QualityReport(multical,DefaultBuild).txt
  21. 4
      i2c.c
  22. 24
      multical.mtpj
  23. 22
      multical.rcpe
  24. 112
      multical.temp.mtud
  25. 2
      r_cg_cgc.c
  26. 2
      r_cg_cgc.h
  27. 2
      r_cg_cgc_user.c
  28. 2
      r_cg_macrodriver.h
  29. 2
      r_cg_port.c
  30. 2
      r_cg_port.h
  31. 2
      r_cg_port_user.c
  32. 14
      r_cg_serial.c
  33. 10
      r_cg_serial.h
  34. 104
      r_cg_serial_user.c
  35. 2
      r_cg_userdefine.h
  36. 395
      r_main.c
  37. 2
      r_systeminit.c
  38. 4
      uart.c
  39. 4
      uart.h

BIN
DefaultBuild/cstart.obj

Binary file not shown.

BIN
DefaultBuild/delay.obj

Binary file not shown.

BIN
DefaultBuild/dipSwitch.obj

Binary file not shown.

BIN
DefaultBuild/gatectrl.obj

Binary file not shown.

BIN
DefaultBuild/i2c.obj

Binary file not shown.

BIN
DefaultBuild/multical.abs

Binary file not shown.

588
DefaultBuild/multical.map

@ -1,4 +1,4 @@
Renesas Optimizing Linker (W3.07.00 ) 03-Feb-2026 21:54:00
Renesas Optimizing Linker (W3.07.00 ) 05-Feb-2026 13:57:59
*** Options ***
@ -62,21 +62,21 @@ SECTION START END SIZE ALIGN
.monitor1
000000ce 000000d7 a 1
.data
000000d8 000002f2 21b 2
000000d8 00000304 22d 2
.text
000002f3 000004a3 1b1 1
00000305 000004b7 1b3 1
.textf
000004a4 0000269d 21fa 1
000004b8 00002967 24b0 1
.const
00003000 0000338d 38e 2
00003000 000033b5 3b6 2
.SLIB
0000338e 00005c62 28d5 1
000033b6 00005c6b 28b6 1
.monitor2
0003fe00 0003ffff 200 1
.bss
000fb500 000fb827 328 2
000fb500 000fbfa7 aa8 2
.dataR
000fb828 000fba42 21b 2
000fbfa8 000fc1d4 22d 2
.sbss
000ffe20 000ffe20 0 2
.sdataR
@ -84,9 +84,9 @@ SECTION START END SIZE ALIGN
*** Total Section Size ***
RAMDATA SECTION: 00000543 Byte(s)
ROMDATA SECTION: 00000855 Byte(s)
PROGRAM SECTION: 00004c80 Byte(s)
RAMDATA SECTION: 00000cd5 Byte(s)
ROMDATA SECTION: 0000088f Byte(s)
PROGRAM SECTION: 00004f19 Byte(s)
*** Symbol List ***
@ -116,421 +116,427 @@ FILE=rlink_generates_02
SECTION=.data
FILE=DefaultBuild\r_main.obj
000000d8 000002e5 20e
000000d8 000002f6 21f
FILE=DefaultBuild\owi.obj
000002e6 000002e9 4
000002f8 000002fb 4
FILE=DefaultBuild\i2c.obj
000002ea 000002ef 6
000002fc 00000301 6
FILE=DefaultBuild\uart.obj
000002f0 000002f0 1
00000302 00000302 1
FILE=DefaultBuild\gatectrl.obj
000002f2 000002f2 1
00000304 00000304 1
SECTION=.text
FILE=DefaultBuild\cstart.obj
000002f3 00000365 73
00000305 00000377 73
_start
000002f3 0 none ,g *
00000305 0 none ,g *
_exit
00000363 0 none ,g *
00000375 0 none ,g *
_atexit
00000365 0 none ,g *
00000377 0 none ,g *
FILE=DefaultBuild\r_cg_serial_user.obj
00000366 000004a3 13e
00000378 000004b7 140
_r_uart0_interrupt_receive@1
00000366 5f func ,l *
00000378 61 func ,l *
_r_uart0_interrupt_send@1
000003c5 2f func ,l *
000003d9 2f func ,l *
_r_uart1_interrupt_receive@1
000003f4 5f func ,l *
00000408 5f func ,l *
_r_uart1_interrupt_send@1
00000453 2f func ,l *
00000467 2f func ,l *
_r_iica0_interrupt@1
00000482 22 func ,l *
00000496 22 func ,l *
SECTION=.textf
FILE=DefaultBuild\stkinit.obj
000004a4 000004e7 44
000004b8 000004fb 44
_stkinit
000004a4 0 none ,g *
000004b8 0 none ,g *
LSTINIT1
000004b2 0 none ,l *
000004c6 0 none ,l *
LSTINIT2
000004dc 0 none ,l *
000004f0 0 none ,l *
LSTINIT3
000004e7 0 none ,l *
000004fb 0 none ,l *
FILE=DefaultBuild\r_main.obj
000004e8 00000fce ae7
000004fc 00001258 d5d
_RS485_Bridge_Push
000004e8 1a func ,g *
000004fc 2b func ,g *
_RS485_Bridge_ResetFifo@1
00000502 7 func ,l *
00000527 e func ,l *
_RS485_Bridge_ReadLine@1
00000535 91 func ,l *
_Is_V_Response_For@1
000005c6 40 func ,l *
_UART1_WaitTxIdle@1
00000509 2c func ,l *
00000606 2c func ,l *
_UART1_SendString_Safe@1
00000535 39 func ,l *
00000632 39 func ,l *
_RS485_Bridge_DrainToPC@1
0000056e 43 func ,l *
0000066b 4d func ,l *
_hex2byte@1
000005b1 56 func ,l *
000006b8 56 func ,l *
_parse_x_prefix@1
00000607 153 func ,l *
0000070e 153 func ,l *
_OUT_PRINT@1
0000075a d func ,l *
00000861 d func ,l *
_parse_x_v_cmd@1
00000767 57 func ,l *
0000086e 57 func ,l *
_send_n_response@1
000007be 2b func ,l *
000008c5 2b func ,l *
_send_v_response@1
000007e9 3f func ,l *
000008f0 3f func ,l *
_UART0_WaitTxDone_Flag@1
0000092f 3f func ,l *
_RS485_FlushJunk@1
0000096e 1b func ,l *
_PC_PrintLine_CRLF@1
00000989 7c func ,l *
_scan_one_addr_rs485@1
00000828 c1 func ,l *
00000a05 10f func ,l *
_build_line_from_rx@1
000008e9 63 func ,l *
00000b14 63 func ,l *
_detect_protocol@1
0000094c 37 func ,l *
00000b77 37 func ,l *
_cmd_unknown@1
00000983 10 func ,l *
00000bae 10 func ,l *
_process_cmd@1
00000993 6d func ,l *
00000bbe 6d func ,l *
_process_cmd_by_prefix@1
00000a00 11 func ,l *
00000c2b 11 func ,l *
_process_one_line@1
00000a11 4de func ,l *
00000c3c 53d func ,l *
_handle_uart_command_line
00000eef 5d func ,g *
00001179 5d func ,g *
_main
00000f4c 6c func ,g *
000011d6 6c func ,g *
_R_MAIN_UserInit
00000fb8 17 func ,g *
00001242 17 func ,g *
FILE=DefaultBuild\r_systeminit.obj
00000fcf 0000100f 41
00001259 00001299 41
_R_Systeminit
00000fcf 3a func ,g *
00001259 3a func ,g *
_hdwinit
00001009 7 func ,g *
00001293 7 func ,g *
FILE=DefaultBuild\r_cg_cgc.obj
00001010 00001039 2a
0000129a 000012c3 2a
_R_CGC_Create
00001010 2a func ,g *
0000129a 2a func ,g *
FILE=DefaultBuild\r_cg_cgc_user.obj
0000103a 0000103c 3
000012c4 000012c6 3
_R_CGC_Get_ResetSource
0000103a 3 func ,g *
000012c4 3 func ,g *
FILE=DefaultBuild\r_cg_serial.obj
0000103d 00001324 2e8
000012c7 000015aa 2e4
_R_SAU0_Create
0000103d 12 func ,g *
000012c7 10 func ,g *
_R_UART0_Create
0000104f 6e func ,g *
000012d7 6e func ,g *
_R_UART0_Start
000010bd 26 func ,g *
00001345 26 func ,g *
_R_UART0_Stop
000010e3 1e func ,g *
0000136b 1e func ,g *
_R_UART0_Receive
00001101 18 func ,g *
00001389 18 func ,g *
_R_UART0_Send
00001119 26 func ,g *
000013a1 26 func ,g *
_R_SAU1_Create
0000113f 12 func ,g *
000013c7 10 func ,g *
_R_UART1_Create
00001151 6e func ,g *
000013d7 6e func ,g *
_R_UART1_Start
000011bf 26 func ,g *
00001445 26 func ,g *
_R_UART1_Stop
000011e5 1e func ,g *
0000146b 1e func ,g *
_R_UART1_Receive
00001203 18 func ,g *
00001489 18 func ,g *
_R_UART1_Send
0000121b 26 func ,g *
000014a1 26 func ,g *
_R_IICA0_Create
00001241 50 func ,g *
000014c7 50 func ,g *
_R_IICA0_Stop
00001291 5 func ,g *
00001517 5 func ,g *
_R_IICA0_StopCondition
00001296 5 func ,g *
0000151c 5 func ,g *
_R_IICA0_Master_Send
0000129b 43 func ,g *
00001521 43 func ,g *
_R_IICA0_Master_Receive
000012de 47 func ,g *
00001564 47 func ,g *
FILE=DefaultBuild\r_cg_serial_user.obj
00001325 0000146f 14b
000015ab 0000174d 1a3
_r_uart0_callback_receiveend@1
00001325 6e func ,l *
000015ab 63 func ,l *
_r_uart0_callback_softwareoverrun@1
00001393 1 func ,l *
0000160e 1 func ,l *
_r_uart0_callback_sendend@1
00001394 9 func ,l *
0000160f 9 func ,l *
_r_uart0_callback_error@1
0000139d 1 func ,l *
00001618 64 func ,l *
_r_uart1_callback_receiveend@1
0000139e 33 func ,l *
0000167c 33 func ,l *
_r_uart1_callback_softwareoverrun@1
000013d1 1 func ,l *
000016af 1 func ,l *
_r_uart1_callback_sendend@1
000013d2 1 func ,l *
000016b0 1 func ,l *
_r_uart1_callback_error@1
000013d3 1 func ,l *
000016b1 1 func ,l *
_iica0_masterhandler@1
000013d4 91 func ,l *
000016b2 91 func ,l *
_r_iica0_callback_master_error@1
00001465 1 func ,l *
00001743 1 func ,l *
_r_iica0_callback_master_receiveend@1
00001466 5 func ,l *
00001744 5 func ,l *
_r_iica0_callback_master_sendend@1
0000146b 5 func ,l *
00001749 5 func ,l *
FILE=DefaultBuild\r_cg_port.obj
00001470 000014c8 59
0000174e 000017a6 59
_R_PORT_Create
00001470 59 func ,g *
0000174e 59 func ,g *
FILE=DefaultBuild\owi.obj
000014c9 00001d56 88e
000017a7 00002034 88e
_OWI_EnablePower
000014c9 1 func ,g *
000017a7 1 func ,g *
_OWI_DisablePower
000014ca 1 func ,g *
000017a8 1 func ,g *
_GPIO_Clear
000014cb b func ,g *
000017a9 b func ,g *
_GPIO_Input
000014d6 7 func ,g *
000017b4 7 func ,g *
_GPIO_Read
000014dd 9 func ,g *
000017bb 9 func ,g *
_OWI_Init
000014e6 18 func ,g *
000017c4 18 func ,g *
_OWI_Start
000014fe 17 func ,g *
000017dc 17 func ,g *
_OWI_Stop
00001515 17 func ,g *
000017f3 17 func ,g *
_OWI_SecureStop
0000152c 51 func ,g *
0000180a 51 func ,g *
_OWI_WriteBit
0000157d 34 func ,g *
0000185b 34 func ,g *
_OWI_WriteByte
000015b1 2a func ,g *
0000188f 2a func ,g *
_OWI_ReadBit
000015db 5e func ,g *
000018b9 5e func ,g *
_OWI_ReadByte
00001639 32 func ,g *
00001917 32 func ,g *
_OWI_T_ReadBytesAndPrint
0000166b ff func ,g *
00001949 ff func ,g *
_OWI_A_CommandMode
0000176a 268 func ,g *
00001a48 268 func ,g *
_OWI_Diagnostic
000019d2 156 func ,g *
00001cb0 156 func ,g *
_OWI_disable
00001b28 18 func ,g *
00001e06 18 func ,g *
_OWI_T_CommandMode
00001b40 5d func ,g *
00001e1e 5d func ,g *
_OWI_CommandMode
00001b9d 4a func ,g *
00001e7b 4a func ,g *
_OWI_ReadBytesAndPrint
00001be7 170 func ,g *
00001ec5 170 func ,g *
FILE=DefaultBuild\i2c.obj
00001d57 000020cb 375
00002035 000023a5 371
_disable
00001d57 26 func ,g *
00002035 26 func ,g *
_I2C_EnablePower
00001d7d 4 func ,g *
0000205b 4 func ,g *
_I2C_DisablePower
00001d81 3 func ,g *
0000205f 3 func ,g *
_I2C_Diagnostic
00001d84 124 func ,g *
00002062 124 func ,g *
_I2C_T_Command_Mode_receiveData
00001ea8 4f func ,g *
00002186 4d func ,g *
_I2C_Command_Mode_receiveData
00001ef7 3e func ,g *
000021d3 3e func ,g *
_I2C_Command_Mode_Send
00001f35 197 func ,g *
00002211 195 func ,g *
FILE=DefaultBuild\uart.obj
000020cc 00002209 13e
000023a6 000024d3 12e
_rs485_set_tx
000020cc b func ,g *
000023a6 b func ,g *
_rs485_init
000020d7 c func ,g *
000023b1 c func ,g *
_UART0_WaitTxDone_Us
000020e3 2f func ,g *
000023bd 2f func ,g *
_RS485_Send
00002112 14 func ,g *
000023ec 14 func ,g *
_RS485_SendString
00002126 11 func ,g *
00002400 11 func ,g *
_uart_send_string
00002137 25 func ,g *
00002411 25 func ,g *
_uart1_send_string
0000215c 12 func ,g *
00002436 12 func ,g *
_uart_send_hex
0000216e 50 func ,g *
00002448 48 func ,g *
_uart1_send_hex
000021be 4c func ,g *
00002490 44 func ,g *
FILE=DefaultBuild\delay.obj
0000220a 000022c8 bf
000024d4 00002592 bf
_delay
0000220a 18 func ,g *
000024d4 18 func ,g *
_delay_us
00002222 82 func ,g *
000024ec 82 func ,g *
_delay_ms
000022a4 25 func ,g *
0000256e 25 func ,g *
FILE=DefaultBuild\dipSwitch.obj
000022c9 000022d9 11
00002593 000025a3 11
_DipSwitch_Init
000022c9 8 func ,g *
00002593 8 func ,g *
_DipSwitch_ReadAddr_0to31
000022d1 9 func ,g *
0000259b 9 func ,g *
FILE=DefaultBuild\gatectrl.obj
000022da 0000269d 3c4
000025a4 00002967 3c4
_Gate_SetByNum
000022da 372 func ,g *
000025a4 372 func ,g *
_Cal_Init
0000264c 21 func ,g *
00002916 21 func ,g *
_Eol_Init
0000266d 21 func ,g *
00002937 21 func ,g *
_GateCtrl_SelectChannel
0000268e 10 func ,g *
00002958 10 func ,g *
SECTION=.const
FILE=DefaultBuild\r_main.obj
00003000 00003151 152
00003000 00003178 179
FILE=DefaultBuild\owi.obj
00003152 00003216 c5
0000317a 0000323e c5
FILE=DefaultBuild\i2c.obj
00003218 00003351 13a
00003240 00003379 13a
FILE=DefaultBuild\gatectrl.obj
00003352 0000338d 3c
0000337a 000033b5 3c
SECTION=.SLIB
FILE=isdigit
0000338e 00003397 a
000033b6 000033bf a
_isdigit
0000338e 0 none ,g *
000033b6 0 none ,g *
FILE=memcpy
00003398 000033a7 10
000033c0 000033cf 10
_memcpy
00003398 0 none ,g *
000033c0 0 none ,g *
FILE=memset
000033a8 000033b5 e
000033d0 000033dd e
_memset
000033a8 0 none ,g *
000033d0 0 none ,g *
FILE=sprintf
000033b6 000034ae f9
000033de 000034d6 f9
_sprintf
000033b6 e1 func ,g *
000033de e1 func ,g *
__REL_sp@1
00003497 18 func ,l *
000034bf 18 func ,l *
FILE=strcpy
000034af 000034bb d
000034d7 000034e3 d
_strcpy
000034af 0 none ,g *
000034d7 0 none ,g *
FILE=strlen
000034bc 000034c6 b
000034e4 000034ee b
_strlen
000034bc 0 none ,g *
FILE=strstr
000034c7 000034e5 1f
_strstr
000034c7 0 none ,g *
000034e4 0 none ,g *
FILE=toupper
000034e6 000034f3 e
000034ef 000034fc e
_toupper
000034e6 0 none ,g *
000034ef 0 none ,g *
FILE=_REL_print
000034f4 0000544b 1f58
000034fd 00005454 1f58
__REL_print
000034f4 1046 func ,g *
000034fd 1046 func ,g *
__REL_fltprn@1
0000453a 941 func ,l *
00004543 941 func ,l *
__REL_henkan1@1
00004e7b 28 func ,l *
00004e84 28 func ,l *
__REL_henkan2@1
00004ea3 33 func ,l *
00004eac 33 func ,l *
__REL_pri@1
00004ed6 298 func ,l *
00004edf 298 func ,l *
__REL_fltgeti@1
0000516e 19d func ,l *
00005177 19d func ,l *
__REL_inmod@1
0000530b 141 func ,l *
00005314 141 func ,l *
FILE=_COM_fdiv
0000544c 00005579 12e
00005455 00005582 12e
__COM_fdiv
000054ab 0 none ,g *
000054b4 0 none ,g *
FILE=_COM_feq
0000557a 0000558f 16
00005583 00005598 16
__COM_feq
0000557a 0 none ,g *
00005583 0 none ,g *
FILE=_COM_fge
00005590 000055a5 16
00005599 000055ae 16
__COM_fge
00005590 0 none ,g *
00005599 0 none ,g *
FILE=_COM_flt
000055a6 000055bb 16
000055af 000055c4 16
__COM_flt
000055a6 0 none ,g *
000055af 0 none ,g *
FILE=_COM_fmul
000055bc 000056a8 ed
000055c5 000056b1 ed
__COM_fmul
00005607 0 none ,g *
00005610 0 none ,g *
FILE=_COM_fne
000056a9 000056b9 11
000056b2 000056c2 11
__COM_fne
000056a9 0 none ,g *
000056b2 0 none ,g *
FILE=_COM_ftosl
000056ba 000056c1 8
000056c3 000056ca 8
__COM_ftosl
000056ba 0 none ,g *
000056c3 0 none ,g *
FILE=_COM_sidiv
000056c2 000056e3 22
000056cb 000056ec 22
__COM_sidiv
000056c4 0 none ,g *
000056cd 0 none ,g *
FILE=_COM_sirem
000056e4 00005703 20
000056ed 0000570c 20
__COM_sirem
000056e4 0 none ,g *
000056ed 0 none ,g *
FILE=_COM_ulldiv
00005704 0000572d 2a
0000570d 00005736 2a
__COM_ulldiv
00005704 0 none ,g *
0000570d 0 none ,g *
FILE=_COM_ullrem
0000572e 0000575e 31
00005737 00005767 31
__COM_ullrem
0000572e 0 none ,g *
00005737 0 none ,g *
FILE=_REL_f_inf
0000575f 00005766 8
00005768 0000576f 8
__REL_f_inf
0000575f 0 none ,g *
00005768 0 none ,g *
FILE=_REL_f_norm
00005767 00005776 10
00005770 0000577f 10
__REL_f_norm
00005767 0 none ,g *
00005770 0 none ,g *
FILE=_REL_f_round
00005777 00005789 13
00005780 00005792 13
__REL_f_round
00005777 0 none ,g *
00005780 0 none ,g *
FILE=_REL_fcmp
0000578a 000057c1 38
00005793 000057ca 38
__REL_fcmp
0000578a 0 none ,g *
00005793 0 none ,g *
FILE=_REL_fordered_core
000057c2 000057dd 1c
000057cb 000057e6 1c
__REL_fordered_core
000057c2 0 none ,g *
000057cb 0 none ,g *
FILE=_REL_ftol
000057de 00005812 35
000057e7 0000581b 35
__REL_ftol
000057de 0 none ,g *
000057e7 0 none ,g *
FILE=_REL_lldiv
00005813 00005a18 206
0000581c 00005a21 206
__REL_lldiv
0000582f 0 none ,g *
00005838 0 none ,g *
FILE=_REL_llrem
00005a19 00005c1c 204
00005a22 00005c25 204
__REL_llrem
00005a36 0 none ,g *
00005a3f 0 none ,g *
FILE=_REL_ltosl
00005c1d 00005c41 25
00005c26 00005c4a 25
__REL_ltosl
00005c1d 0 none ,g *
00005c26 0 none ,g *
FILE=_COM_lshr
00005c42 00005c62 21
00005c4b 00005c6b 21
__COM_lshr
00005c4c 0 none ,g *
00005c55 0 none ,g *
SECTION=.monitor2
FILE=rlink_generates_02
@ -538,109 +544,119 @@ FILE=rlink_generates_02
SECTION=.bss
FILE=DefaultBuild\r_main.obj
000fb500 000fb783 284
_s_rb_fifo@1
000fb500 100 data ,l *
_g_uart1_txbuf@4
000fb600 80 data ,l *
_txbuf@6@process_one_line@1
000fb680 104 data ,l *
000fb500 000fbf03 a04
_s_rb_fifo@2
000fb500 800 data ,l *
_g_uart1_txbuf@5
000fbd00 100 data ,l *
_txbuf@7@process_one_line@1
000fbe00 104 data ,l *
FILE=DefaultBuild\r_cg_serial.obj
000fb784 000fb7a3 20
000fbf04 000fbf23 20
_gp_uart0_tx_address
000fb784 2 data ,g *
000fbf04 2 data ,g *
_g_uart0_tx_count
000fb786 2 data ,g *
000fbf06 2 data ,g *
_gp_uart0_rx_address
000fb788 2 data ,g *
000fbf08 2 data ,g *
_g_uart0_rx_count
000fb78a 2 data ,g *
000fbf0a 2 data ,g *
_g_uart0_rx_length
000fb78c 2 data ,g *
000fbf0c 2 data ,g *
_gp_uart1_tx_address
000fb78e 2 data ,g *
000fbf0e 2 data ,g *
_g_uart1_tx_count
000fb790 2 data ,g *
000fbf10 2 data ,g *
_gp_uart1_rx_address
000fb792 2 data ,g *
000fbf12 2 data ,g *
_g_uart1_rx_count
000fb794 2 data ,g *
000fbf14 2 data ,g *
_g_uart1_rx_length
000fb796 2 data ,g *
000fbf16 2 data ,g *
_g_iica0_master_status_flag
000fb798 1 data ,g *
000fbf18 1 data ,g *
_g_iica0_slave_status_flag
000fb799 1 data ,g *
000fbf19 1 data ,g *
_gp_iica0_rx_address
000fb79a 2 data ,g *
000fbf1a 2 data ,g *
_g_iica0_rx_len
000fb79c 2 data ,g *
000fbf1c 2 data ,g *
_g_iica0_rx_cnt
000fb79e 2 data ,g *
000fbf1e 2 data ,g *
_gp_iica0_tx_address
000fb7a0 2 data ,g *
000fbf20 2 data ,g *
_g_iica0_tx_cnt
000fb7a2 2 data ,g *
000fbf22 2 data ,g *
FILE=sprintf
000fb7a4 000fb7a7 4
000fbf24 000fbf27 4
__REL_pointer@1
000fb7a4 4 data ,l *
000fbf24 4 data ,l *
FILE=_REL_print
000fb7a8 000fb827 80
000fbf28 000fbfa7 80
_qt@1@_REL_inmod@1
000fb7a8 80 data ,l *
000fbf28 80 data ,l *
SECTION=.dataR
FILE=DefaultBuild\r_main.obj
000fb828 000fba35 20e
000fbfa8 000fc1c6 21f
_uart_rx_done
000fb828 1 data ,g *
000fbfa8 1 data ,g *
_uart_rx_index
000fb829 1 data ,g *
000fbfa9 1 data ,g *
_uart_rx_buffer
000fb82a 100 data ,g *
000fbfaa 100 data ,g *
_uart_rx_length
000fb92a 2 data ,g *
000fc0aa 2 data ,g *
_rs485_rx_done
000fb92c 1 data ,g *
000fc0ac 1 data ,g *
_rs485_rx_index
000fb92d 1 data ,g *
000fc0ad 1 data ,g *
_rs485_rx_buffer
000fb92e 100 data ,g *
000fc0ae 100 data ,g *
_rs485_rx_length
000fba2e 2 data ,g *
000fc1ae 2 data ,g *
_g_uart0_err_fef
000fc1b0 4 data ,g *
_g_uart0_err_ovf
000fc1b4 4 data ,g *
_g_uart0_err_pef
000fc1b8 4 data ,g *
_g_rs485_bridge_active
000fba30 1 data ,g *
000fc1bc 1 data ,g *
_g_rs485_bridge_done
000fba31 1 data ,g *
000fc1bd 1 data ,g *
_g_rs485_bridge_seq
000fc1be 2 data ,g *
_s_end_st@1
000fc1c0 1 data ,l *
_g_fixed_addr
000fba32 1 data ,g *
_s_rb_head@2
000fba33 1 data ,l *
_s_rb_tail@3
000fba34 1 data ,l *
_s_prefix_mode@5
000fba35 1 data ,l *
000fc1c1 1 data ,g *
_s_rb_head@3
000fc1c2 2 data ,l *
_s_rb_tail@4
000fc1c4 2 data ,l *
_s_prefix_mode@6
000fc1c6 1 data ,l *
FILE=DefaultBuild\owi.obj
000fba36 000fba39 4
000fc1c8 000fc1cb 4
_bit_period_us@1
000fba36 4 data ,l *
000fc1c8 4 data ,l *
FILE=DefaultBuild\i2c.obj
000fba3a 000fba3f 6
000fc1cc 000fc1d1 6
_g_i2c_last_command
000fba3a 3 data ,g *
000fc1cc 3 data ,g *
_g_i2c_command_valid
000fba3d 1 data ,g *
000fc1cf 1 data ,g *
_dis@1@disable
000fba3e 2 data ,l *
000fc1d0 2 data ,l *
FILE=DefaultBuild\uart.obj
000fba40 000fba40 1
000fc1d2 000fc1d2 1
_g_uart0_tx_done
000fba40 1 data ,g *
000fc1d2 1 data ,g *
FILE=DefaultBuild\gatectrl.obj
000fba42 000fba42 1
000fc1d4 000fc1d4 1
_s_ch@1
000fba42 1 data ,l *
000fc1d4 1 data ,l *
Absolute value symbols
FILE=DefaultBuild\gatectrl.obj
@ -648,17 +664,17 @@ FILE=DefaultBuild\gatectrl.obj
00000028 0 none ,l *
FILE=rlink_generates_05
__s.text
000002f3 0 none ,g *
00000305 0 none ,g *
__e.text
000004a4 0 none ,g *
000004b8 0 none ,g *
__s.textf
000004a4 0 none ,g *
000004b8 0 none ,g *
__e.textf
0000269e 0 none ,g *
00002968 0 none ,g *
__s.const
00003000 0 none ,g *
__e.const
0000338e 0 none ,g *
000033b6 0 none ,g *
__s.constf
00000080 0 none ,g *
__e.constf
@ -666,7 +682,7 @@ FILE=rlink_generates_05
__s.data
000000d8 0 none ,g *
__e.data
000002f3 0 none ,g *
00000305 0 none ,g *
__s.sdata
00000080 0 none ,g *
__e.sdata
@ -674,15 +690,15 @@ FILE=rlink_generates_05
__s.bss
000fb500 0 none ,g *
__e.bss
000fb828 0 none ,g *
000fbfa8 0 none ,g *
__s.sbss
000ffe20 0 none ,g *
__e.sbss
000ffe20 0 none ,g *
__s.dataR
000fb828 0 none ,g *
000fbfa8 0 none ,g *
__e.dataR
000fba43 0 none ,g *
000fc1d5 0 none ,g *
__s.sdataR
000ffe20 0 none ,g *
__e.sdataR
@ -696,9 +712,9 @@ FILE=rlink_generates_05
__e.RLIB
000000c4 0 none ,g *
__s.SLIB
0000338e 0 none ,g *
000033b6 0 none ,g *
__e.SLIB
00005c63 0 none ,g *
00005c6c 0 none ,g *
__s.option_byte
000000c0 0 none ,g *
__e.option_byte
@ -726,7 +742,7 @@ FILE=rlink_generates_05
__STACK_ADDR_START
000ffe20 0 none ,g *
__STACK_ADDR_END
000fba44 0 none ,g *
000fc1d6 0 none ,g *
*** Unfilled Areas ***

2625
DefaultBuild/multical.mot

File diff suppressed because it is too large

BIN
DefaultBuild/owi.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_cgc.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_cgc_user.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_port.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_port_user.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_serial.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_serial_user.obj

Binary file not shown.

BIN
DefaultBuild/r_main.obj

Binary file not shown.

BIN
DefaultBuild/r_systeminit.obj

Binary file not shown.

BIN
DefaultBuild/stkinit.obj

Binary file not shown.

BIN
DefaultBuild/uart.obj

Binary file not shown.

40
QualityReport(multical,DefaultBuild).txt

@ -1,22 +1,22 @@
QualityReport
2026년 2월 4일 수요일 오전 8:55:15
2026년 2월 5일 목요일 오후 2:02:43
------ Start build(multical, DefaultBuild) ------
------ Build ended(Error:0, Warning:0)(multical, DefaultBuild) ------
--- SHA1 hash value of output files ---
C:\Users\MSI\Desktop\amosense\new_fw\DefaultBuild\multical.abs: d0043499de30ff8c530d319ee0f7dd2f322f2ab8
C:\Users\MSI\Desktop\amosense\new_fw\DefaultBuild\multical.mot: cafe18f9151918de73909e0795d46d56248d65ad
C:\Users\temp\Desktop\new_fw\DefaultBuild\multical.abs: 8c34dc35fd1a827d4e5eee656b2695c8821e9889
C:\Users\temp\Desktop\new_fw\DefaultBuild\multical.mot: 7e2e91996c4c0d330dc3579dcc206a229f0eef8f
--- System Information ---
*OS Version
Microsoft Windows 11 Home (-, 10.0.26200, WOW64)
Microsoft Windows 10 Pro (-, 10.0.19045, WOW64)
*Language
한국어(대한민국)
*.NET Framework Version
Microsoft .NET Framework 4 [.NET 4.8 or later] (533509)
Microsoft .NET Framework 4 [.NET 4.8 or later] (533325)
*WebView2 Version
144.0.3719.93
@ -29,21 +29,19 @@ C:\Users\MSI\Desktop\amosense\new_fw\DefaultBuild\multical.mot: cafe18f9151918de
V9.13.00.05 [12 Nov 2024]
*Assembly Version
3.12.10.1
*Sales Area
Japan
*Product License
*Execution Place
C:\Program Files (x86)\Renesas Electronics\CS+\CC
*Memory Usage
*Private Working Set
278 MB
296 MB
*Number of GDI Objects
2550
2611
*Number of USER Objects
1307
1570
*Opened Files
23 editors, 23 files, 188 KB
24 editors, 24 files, 194 KB
--- Build Tool Plug-in Information ---
RH850 Build tool CC-RH Plug-in
@ -148,20 +146,6 @@ Editor plug-in DLL
1.1.0.0
*DLL File Name
SEditor.dll
Smart Configurator for RH850 Communication Plug-in
*Version
V1.02.10.03 [14 Nov 2024]
*Assembly Version
1.0.0.0
*DLL File Name
SmcCodePartRH850.dll
Smart Configurator for RL78 Communication Plug-in
*Version
V1.00.11.01 [25 Nov 2024]
*Assembly Version
1.0.0.0
*DLL File Name
SmcCodePartRL78.dll
Stack Usage Tracer
*Version
V1.05.00.02 [30 Jul 2014]
@ -193,7 +177,7 @@ Device Information Common Interface
DeviceInformation.dll
--- Main Project Information ---
C:\Users\MSI\Desktop\amosense\new_fw\multical.mtpj
C:\Users\temp\Desktop\new_fw\multical.mtpj
Microcontroller Information
*R5F10PPJ
*File Name: Version
@ -234,10 +218,6 @@ Other Tool Information
*Version
V4.13.00.03 [24 May 2023]
*None
*None
*Code Generator
Other Information
*RL78/F14 Code Library

4
i2c.c

@ -208,7 +208,7 @@ void I2C_T_Command_Mode_receiveData(const uint8_t *tx_data, uint8_t tx_len,uint8
R_IICA0_Create();
I2C_EnablePower();
delay(1000000);
delay(10000);
if (R_IICA0_Master_Send((id << 1), tx_data, tx_len, 100) != MD_OK)
{
@ -313,7 +313,7 @@ void I2C_Command_Mode_Send(uint8_t tx_len, uint8_t id)
HOST_PRINT("I2C Receive Failed\r\n");
return;
}
delay(1000000);
delay(10000);
sprintf(uart_buf, "%02X ", rx[0]);
strcpy(tmp_buf, uart_buf);

24
multical.mtpj

@ -1938,6 +1938,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
<DebuggerProperty-HookProperty-HookTransaction-Broke-Length>0</DebuggerProperty-HookProperty-HookTransaction-Broke-Length>
<DebuggerProperty-HookProperty-HookTransaction-Connected-Length>0</DebuggerProperty-HookProperty-HookTransaction-Connected-Length>
<DebuggerProperty-HookProperty-HookTransaction-Disconnecting-Length>0</DebuggerProperty-HookProperty-HookTransaction-Disconnecting-Length>
<DebuggerProperty-EssentialProperty-EmulatorConnect-SerialNumber />
</Instance>
</Class>
<Class Guid="9f7af90c-526c-4f28-af29-524df208b9e0">
@ -4282,7 +4283,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;/RTC1HZ&gt;
&lt;RXD0 Name="RXD0" Text="enable" /&gt;
&lt;ProjectName Name="PrjName" Text="multical" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\user\Documents\카카오톡 받은 파일\Amosense_Firmware 최종\Amosense_Firmware 최종" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\temp\Desktop\new_fw" /&gt;
&lt;ProjectKind Name="PrjKind" Text="Project78K0R" /&gt;
&lt;DeviceName Name="DeviceName" Fixed="" Text="RL78F14" /&gt;
&lt;MCUName Name="MCUName" Text="RL78F14_100pin" /&gt;
@ -5965,7 +5966,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="RECEIVE_PARITY_ODD" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_ZERO" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_NONE" value="true" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="115200" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_RECEIVE_END_USE" value="true" /&gt;
&lt;setting name="Receive_error_callback_function" value="generated" /&gt;
&lt;setting name="TRANSFER_MODE_CONTINUOUS" value="false" /&gt;
@ -5984,7 +5985,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="TRANSMIT_PARITY_NONE" value="true" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_2_BITS" value="false" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_1_BIT" value="true" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="115200" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_TRANSMIT_END_USE" value="true" /&gt;
&lt;setting name="INT_PRIORITY_TRANSMIT_END" value="3" /&gt;
&lt;setting name="INT_PRIORITY_RECEPTION_END" value="3" /&gt;
@ -6051,7 +6052,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="RECEIVE_PARITY_ODD" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_ZERO" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_NONE" value="true" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="115000" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_RECEIVE_END_USE" value="true" /&gt;
&lt;setting name="Receive_error_callback_function" value="generated" /&gt;
&lt;setting name="TRANSFER_MODE_CONTINUOUS" value="false" /&gt;
@ -6070,7 +6071,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="TRANSMIT_PARITY_NONE" value="true" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_2_BITS" value="false" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_1_BIT" value="true" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="115000" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_TRANSMIT_END_USE" value="true" /&gt;
&lt;setting name="INT_PRIORITY_TRANSMIT_END" value="3" /&gt;
&lt;setting name="INT_PRIORITY_RECEPTION_END" value="3" /&gt;
@ -6127,13 +6128,13 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="SLAVE_MODE_USED" value="false" /&gt;
&lt;setting name="MODULE_UNUSE" value="false" /&gt;
&lt;setting name="SINGLE_MASTER_USED" value="true" /&gt;
&lt;Slave0&gt;
&lt;Master0&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK" value="false" /&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK_HALF" value="true" /&gt;
&lt;setting name="LOCAL_ADDRESS_VALUE" value="16" /&gt;
&lt;setting name="TRANSFER_SPEED_STANDARD" value="true" /&gt;
&lt;setting name="TRANSFER_SPEED_HIGH" value="false" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="100000" /&gt;
&lt;setting name="DIGITAL_FILITER_USED" value="false" /&gt;
&lt;setting name="INTERRUPT_IICA_PRIORITY" value="3" /&gt;
&lt;setting name="MASTER_RECEPT_END_CALLBACK_USED" value="true" /&gt;
@ -6145,14 +6146,14 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="SLAVE_ERROR_END_CALLBACK_USED" value="true" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_ON" value="false" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_OFF" value="true" /&gt;
&lt;/Slave0&gt;
&lt;Master0&gt;
&lt;/Master0&gt;
&lt;Slave0&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK" value="false" /&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK_HALF" value="true" /&gt;
&lt;setting name="LOCAL_ADDRESS_VALUE" value="16" /&gt;
&lt;setting name="TRANSFER_SPEED_STANDARD" value="true" /&gt;
&lt;setting name="TRANSFER_SPEED_HIGH" value="false" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="100000" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="" /&gt;
&lt;setting name="DIGITAL_FILITER_USED" value="false" /&gt;
&lt;setting name="INTERRUPT_IICA_PRIORITY" value="3" /&gt;
&lt;setting name="MASTER_RECEPT_END_CALLBACK_USED" value="true" /&gt;
@ -6164,7 +6165,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="SLAVE_ERROR_END_CALLBACK_USED" value="true" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_ON" value="false" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_OFF" value="true" /&gt;
&lt;/Master0&gt;
&lt;/Slave0&gt;
&lt;/IICA0&gt;
&lt;PORT&gt;
&lt;PortP0&gt;
@ -7302,6 +7303,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;/RL78F14&gt;</CodeGenerator>
<FormatVersion>1.0</FormatVersion>
<ToolGUID>95279bbe-6d22-4c1c-844e-cd135cf17b88</ToolGUID>
<CodeGeneratorItem>cd2e4292-1297-4c3b-8415-f027a507b349</CodeGeneratorItem>
</Instance>
</Class>
<Class Guid="2a2c2a43-ecdb-4e88-80bd-e75f3e33db90">

22
multical.rcpe

@ -379,7 +379,7 @@
&lt;/RTC1HZ&gt;
&lt;RXD0 Name="RXD0" Text="enable" /&gt;
&lt;ProjectName Name="PrjName" Text="multical" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\user\Documents\카카오톡 받은 파일\Amosense_Firmware 최종\Amosense_Firmware 최종" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\temp\Desktop\new_fw" /&gt;
&lt;ProjectKind Name="PrjKind" Text="Project78K0R" /&gt;
&lt;DeviceName Name="DeviceName" Fixed="" Text="RL78F14" /&gt;
&lt;MCUName Name="MCUName" Text="RL78F14_100pin" /&gt;
@ -2062,7 +2062,7 @@
&lt;setting name="RECEIVE_PARITY_ODD" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_ZERO" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_NONE" value="true" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="115200" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_RECEIVE_END_USE" value="true" /&gt;
&lt;setting name="Receive_error_callback_function" value="generated" /&gt;
&lt;setting name="TRANSFER_MODE_CONTINUOUS" value="false" /&gt;
@ -2081,7 +2081,7 @@
&lt;setting name="TRANSMIT_PARITY_NONE" value="true" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_2_BITS" value="false" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_1_BIT" value="true" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="115200" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_TRANSMIT_END_USE" value="true" /&gt;
&lt;setting name="INT_PRIORITY_TRANSMIT_END" value="3" /&gt;
&lt;setting name="INT_PRIORITY_RECEPTION_END" value="3" /&gt;
@ -2148,7 +2148,7 @@
&lt;setting name="RECEIVE_PARITY_ODD" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_ZERO" value="false" /&gt;
&lt;setting name="RECEIVE_PARITY_NONE" value="true" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="115000" /&gt;
&lt;setting name="RECEIVE_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_RECEIVE_END_USE" value="true" /&gt;
&lt;setting name="Receive_error_callback_function" value="generated" /&gt;
&lt;setting name="TRANSFER_MODE_CONTINUOUS" value="false" /&gt;
@ -2167,7 +2167,7 @@
&lt;setting name="TRANSMIT_PARITY_NONE" value="true" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_2_BITS" value="false" /&gt;
&lt;setting name="TRANSMIT_STOP_LENGTH_1_BIT" value="true" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="115000" /&gt;
&lt;setting name="TRANSMIT_TRANSFER_BAUDRATE_VALUE" value="460800" /&gt;
&lt;setting name="CALLBACK_TRANSMIT_END_USE" value="true" /&gt;
&lt;setting name="INT_PRIORITY_TRANSMIT_END" value="3" /&gt;
&lt;setting name="INT_PRIORITY_RECEPTION_END" value="3" /&gt;
@ -2224,13 +2224,13 @@
&lt;setting name="SLAVE_MODE_USED" value="false" /&gt;
&lt;setting name="MODULE_UNUSE" value="false" /&gt;
&lt;setting name="SINGLE_MASTER_USED" value="true" /&gt;
&lt;Slave0&gt;
&lt;Master0&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK" value="false" /&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK_HALF" value="true" /&gt;
&lt;setting name="LOCAL_ADDRESS_VALUE" value="16" /&gt;
&lt;setting name="TRANSFER_SPEED_STANDARD" value="true" /&gt;
&lt;setting name="TRANSFER_SPEED_HIGH" value="false" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="100000" /&gt;
&lt;setting name="DIGITAL_FILITER_USED" value="false" /&gt;
&lt;setting name="INTERRUPT_IICA_PRIORITY" value="3" /&gt;
&lt;setting name="MASTER_RECEPT_END_CALLBACK_USED" value="true" /&gt;
@ -2242,14 +2242,14 @@
&lt;setting name="SLAVE_ERROR_END_CALLBACK_USED" value="true" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_ON" value="false" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_OFF" value="true" /&gt;
&lt;/Slave0&gt;
&lt;Master0&gt;
&lt;/Master0&gt;
&lt;Slave0&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK" value="false" /&gt;
&lt;setting name="CPU_PERIPHERAL_CLOCK_HALF" value="true" /&gt;
&lt;setting name="LOCAL_ADDRESS_VALUE" value="16" /&gt;
&lt;setting name="TRANSFER_SPEED_STANDARD" value="true" /&gt;
&lt;setting name="TRANSFER_SPEED_HIGH" value="false" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="100000" /&gt;
&lt;setting name="TRANSFER_SPEED_VALUE" value="" /&gt;
&lt;setting name="DIGITAL_FILITER_USED" value="false" /&gt;
&lt;setting name="INTERRUPT_IICA_PRIORITY" value="3" /&gt;
&lt;setting name="MASTER_RECEPT_END_CALLBACK_USED" value="true" /&gt;
@ -2261,7 +2261,7 @@
&lt;setting name="SLAVE_ERROR_END_CALLBACK_USED" value="true" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_ON" value="false" /&gt;
&lt;setting name="SLAVE_WAKEUP_MODE_OFF" value="true" /&gt;
&lt;/Master0&gt;
&lt;/Slave0&gt;
&lt;/IICA0&gt;
&lt;PORT&gt;
&lt;PortP0&gt;

112
multical.temp.mtud

File diff suppressed because one or more lines are too long

2
r_cg_cgc.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
/***********************************************************************************************************************

2
r_cg_cgc.h

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
#ifndef CGC_H

2
r_cg_cgc_user.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
/***********************************************************************************************************************

2
r_cg_macrodriver.h

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements general head file.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
#ifndef STATUS_H

2
r_cg_port.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
/***********************************************************************************************************************

2
r_cg_port.h

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
#ifndef PORT_H

2
r_cg_port_user.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
/***********************************************************************************************************************

14
r_cg_serial.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for Serial module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
/***********************************************************************************************************************
@ -77,7 +77,7 @@ void R_SAU0_Create(void)
NOP();
NOP();
NOP();
SPS0 = _0001_SAU_CK00_FCLK_1 | _0010_SAU_CK01_FCLK_1;
SPS0 = _0000_SAU_CK00_FCLK_0 | _0000_SAU_CK01_FCLK_0;
R_UART0_Create();
}
@ -103,13 +103,13 @@ void R_UART0_Create(void)
SMR00 = _0020_SAU_SMRMN_INITIALVALUE | _0000_SAU_CLOCK_SELECT_CK00 | _0000_SAU_TRIGGER_SOFTWARE |
_0002_SAU_MODE_UART | _0000_SAU_TRANSFER_END;
SCR00 = _8000_SAU_TRANSMISSION | _0000_SAU_PARITY_NONE | _0080_SAU_LSB | _0010_SAU_STOP_1 | _0007_SAU_LENGTH_8;
SDR00 = _8800_UART0_TRANSMIT_DIVISOR;
SDR00 = _4400_UART0_TRANSMIT_DIVISOR;
NFEN0 |= _01_SAU_RXD0_FILTER_ON;
SIR01 = _0004_SAU_SIRMN_FECTMN | _0002_SAU_SIRMN_PECTMN | _0001_SAU_SIRMN_OVCTMN; /* clear error flag */
SMR01 = _0020_SAU_SMRMN_INITIALVALUE | _0000_SAU_CLOCK_SELECT_CK00 | _0100_SAU_TRIGGER_RXD | _0000_SAU_EDGE_FALL |
_0002_SAU_MODE_UART | _0000_SAU_TRANSFER_END;
SCR01 = _4000_SAU_RECEPTION | _0000_SAU_PARITY_NONE | _0080_SAU_LSB | _0010_SAU_STOP_1 | _0007_SAU_LENGTH_8;
SDR01 = _8800_UART0_RECEIVE_DIVISOR;
SDR01 = _4400_UART0_RECEIVE_DIVISOR;
SO0 |= _0001_SAU_CH0_DATA_OUTPUT_1;
SOL0 |= _0000_SAU_CHANNEL0_NORMAL; /* output level normal */
SOE0 |= _0001_SAU_CH0_OUTPUT_ENABLE; /* enable UART0 output */
@ -226,7 +226,7 @@ void R_SAU1_Create(void)
NOP();
NOP();
NOP();
SPS1 = _0001_SAU_CK00_FCLK_1 | _0010_SAU_CK01_FCLK_1;
SPS1 = _0000_SAU_CK00_FCLK_0 | _0000_SAU_CK01_FCLK_0;
R_UART1_Create();
}
@ -252,13 +252,13 @@ void R_UART1_Create(void)
SMR10 = _0020_SAU_SMRMN_INITIALVALUE | _0000_SAU_CLOCK_SELECT_CK00 | _0000_SAU_TRIGGER_SOFTWARE |
_0002_SAU_MODE_UART | _0000_SAU_TRANSFER_END;
SCR10 = _8000_SAU_TRANSMISSION | _0000_SAU_PARITY_NONE | _0080_SAU_LSB | _0010_SAU_STOP_1 | _0007_SAU_LENGTH_8;
SDR10 = _8A00_UART1_TRANSMIT_DIVISOR;
SDR10 = _4400_UART1_TRANSMIT_DIVISOR;
NFEN0 |= _04_SAU_RXD1_FILTER_ON;
SIR11 = _0004_SAU_SIRMN_FECTMN | _0002_SAU_SIRMN_PECTMN | _0001_SAU_SIRMN_OVCTMN; /* clear error flag */
SMR11 = _0020_SAU_SMRMN_INITIALVALUE | _0000_SAU_CLOCK_SELECT_CK00 | _0100_SAU_TRIGGER_RXD | _0000_SAU_EDGE_FALL |
_0002_SAU_MODE_UART | _0000_SAU_TRANSFER_END;
SCR11 = _4000_SAU_RECEPTION | _0000_SAU_PARITY_NONE | _0080_SAU_LSB | _0010_SAU_STOP_1 | _0007_SAU_LENGTH_8;
SDR11 = _8A00_UART1_RECEIVE_DIVISOR;
SDR11 = _4400_UART1_RECEIVE_DIVISOR;
SO1 |= _0001_SAU_CH0_DATA_OUTPUT_1;
SOL1 |= _0000_SAU_CHANNEL0_NORMAL; /* output level normal */
SOE1 |= _0001_SAU_CH0_OUTPUT_ENABLE; /* enable UART1 output */

10
r_cg_serial.h

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for Serial module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
#ifndef SERIAL_H
@ -348,10 +348,10 @@ Macro definitions (Register bit)
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#define _8800_UART0_RECEIVE_DIVISOR (0x8800U)
#define _8800_UART0_TRANSMIT_DIVISOR (0x8800U)
#define _8A00_UART1_RECEIVE_DIVISOR (0x8A00U)
#define _8A00_UART1_TRANSMIT_DIVISOR (0x8A00U)
#define _4400_UART0_RECEIVE_DIVISOR (0x4400U)
#define _4400_UART0_TRANSMIT_DIVISOR (0x4400U)
#define _4400_UART1_RECEIVE_DIVISOR (0x4400U)
#define _4400_UART1_TRANSMIT_DIVISOR (0x4400U)
#define _10_IICA0_MASTERADDRESS (0x10U)
#define _55_IICA0_IICWH_VALUE (0x55U)
#define _4C_IICA0_IICWL_VALUE (0x4CU)

104
r_cg_serial_user.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for Serial module.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
/***********************************************************************************************************************
@ -76,7 +76,13 @@ extern volatile uint8_t g_rs485_bridge_active;
extern volatile uint8_t g_rs485_bridge_done;
void RS485_Bridge_Push(uint8_t b);
extern volatile uint32_t g_uart0_err_fef;
extern volatile uint32_t g_uart0_err_ovf;
extern volatile uint32_t g_uart0_err_pef;
extern volatile uint8_t g_uart0_tx_done;
extern volatile uint16_t g_rs485_bridge_seq;
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
@ -89,30 +95,27 @@ static void __near r_uart0_interrupt_receive(void)
{
volatile uint8_t rx_data;
volatile uint8_t err_type;
err_type = (uint8_t)(SSR01 & 0x0007U);
SIR01 = (uint16_t)err_type;
if (err_type != 0U)
{
rx_data = SDR01L;
if (err_type != 0U) {
r_uart0_callback_error(err_type);
return;
}
rx_data = SDR01L;
if (g_uart0_rx_length > g_uart0_rx_count)
{
*gp_uart0_rx_address = rx_data;
/* ---- CodeGenerator ?? ?? ?? ---- */
if (g_uart0_rx_length > g_uart0_rx_count) {
*gp_uart0_rx_address = (uint8_t)rx_data;
gp_uart0_rx_address++;
g_uart0_rx_count++;
g_uart0_rx_count++;
if (g_uart0_rx_length == g_uart0_rx_count)
{
if (g_uart0_rx_length == g_uart0_rx_count) {
r_uart0_callback_receiveend();
}
}
else
{
} else {
r_uart0_callback_softwareoverrun(rx_data);
}
}
@ -145,55 +148,56 @@ static void __near r_uart0_interrupt_send(void)
***********************************************************************************************************************/
static void r_uart0_callback_receiveend(void)
{
/* Start user code. Do not edit comment generated here */
uint8_t c;
c = rs485_rx_buffer[rs485_rx_index];
// Bridge mode: stream RS485 bytes to PC as they arrive
if (g_rs485_bridge_active) {
uint8_t c = rs485_rx_buffer[rs485_rx_index];
if (g_rs485_bridge_active) {
RS485_Bridge_Push(c);
if (c == '\n') {
g_rs485_bridge_done = 1;
}
g_rs485_bridge_seq++;
// ?????? 1????? ???? ?? index=0 ??
/* ??? ????? rs485_rx_buffer ?? ??? ?? ??? ??? ?? */
rs485_rx_index = 0;
rs485_rx_length = 0;
/* ?? 1??? ?? ?? */
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
return;
}
// ===== ??(?-???) ?? =====
if (rs485_rx_index < (UART_RX_BUF_SIZE - 1)) {
rs485_rx_index++;
rs485_rx_length = rs485_rx_index;
}
/* =========================
* (B) NORMAL MODE (x... ???? ???? ??)
* ========================= */
// ?? ?(?? ?? ??)
if (c == '\r' || c == '\n' || rs485_rx_index >= (UART_RX_BUF_SIZE - 1)) {
/* ??/????? ?? ?? ?? */
if (c == '\r' || c == '\n' || rs485_rx_index >= (UART_RX_BUF_SIZE - 1))
{
/* ???? ??? ?? = rs485_rx_index (?? ?? ?) */
rs485_rx_length = rs485_rx_index;
// ? ??: RS485?? ???? "???(x...)"? ????.
// Vxx / Nxx / Err:... ?? "??"? ????? ?? ? ? ? ??
/* x? ???? ??? “??”?? ?? */
if (rs485_rx_length > 0) {
uint8_t first = rs485_rx_buffer[0];
if (first == 'x' || first == 'X') {
rs485_rx_done = 1;
return; // ?? ??? ?? Receive? ??
return; /* main loop? ?? ? ?? re-arm */
}
}
// ??? ??: ???? ???? DROP
/* x? ??? ?? + ?? 1??? ?? ?? */
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
return;
}
// ?? ??? ?? ??
/* ?? ?? ? ??: ?? ??? ?? ??? ?? */
rs485_rx_index++;
rs485_rx_length = rs485_rx_index;
/* ?? 1??? ?? */
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[rs485_rx_index], 1);
/* End user code. Do not edit comment generated here */
}
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_uart0_callback_softwareoverrun
@ -217,7 +221,7 @@ static void r_uart0_callback_softwareoverrun(uint16_t rx_data)
static void r_uart0_callback_sendend(void)
{
/* Start user code. Do not edit comment generated here */
rs485_set_tx(0); // RX? ??
rs485_set_tx(0);
g_uart0_tx_done = 1;
/* End user code. Do not edit comment generated here */
}
@ -232,6 +236,22 @@ static void r_uart0_callback_sendend(void)
static void r_uart0_callback_error(uint8_t err_type)
{
/* Start user code. Do not edit comment generated here */
if (err_type & 0x04) g_uart0_err_fef++; // Framing
if (err_type & 0x01) g_uart0_err_ovf++; // Overrun
if (err_type & 0x02) g_uart0_err_pef++; // Parity
(void)err_type;
// 1) ?? ?? ?? ??
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_length = 0;
// 2) ??? ??? ????? ? ??? ???? ??
g_rs485_bridge_done = 0;
// 3) ?? 1??? ?? ??(????)
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
/* End user code. Do not edit comment generated here */
}
@ -260,7 +280,7 @@ static void __near r_uart1_interrupt_receive(void)
{
*gp_uart1_rx_address = rx_data;
gp_uart1_rx_address++;
g_uart1_rx_count++;
g_uart1_rx_count++;
if (g_uart1_rx_length == g_uart1_rx_count)
{

2
r_cg_userdefine.h

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file includes user definition.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
#ifndef _USER_DEF_H

395
r_main.c

@ -1,6 +1,20 @@
/***********************************************************************************************************************
* DISCLAIMER ... (: )
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
@ -12,6 +26,10 @@
* Creation Date: 2026-01-29
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
#include "r_cg_port.h"
@ -28,13 +46,16 @@
#include <r_cg_port.h>
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/* Start user code for adding. Do not edit comment generated here */
/* =========================
* Config
* ========================= */
#define CMD_MAX 529
#define UART_RX_BUF_SIZE 256 /* 네 프로젝트 값에 맞춰 유지 */
#define RS485_BRIDGE_FIFO_SZ 256
#define UART_RX_BUF_SIZE 256
#define RS485_BRIDGE_FIFO_SZ 2048
#define BRIDGE_IDLE_DONE_US 5000U // 마지막 바이트 이후 3ms 조용하면 종료로 판단
#define BRIDGE_TOTAL_WAIT_US 600000U
/* =========================
* UART RX Buffers
@ -49,10 +70,18 @@ volatile uint8_t rs485_rx_index = 0;
volatile uint8_t rs485_rx_buffer[UART_RX_BUF_SIZE] = {0};
volatile uint16_t rs485_rx_length = 0;
volatile uint32_t g_uart0_err_fef = 0;
volatile uint32_t g_uart0_err_ovf = 0;
volatile uint32_t g_uart0_err_pef = 0;
/* RS485 bridge flags */
volatile uint8_t g_rs485_bridge_active = 0;
volatile uint8_t g_rs485_bridge_done = 0;
volatile uint16_t g_rs485_bridge_seq = 0;
static volatile uint8_t s_end_st = 0;
static const char s_end_pat[] = "<end>";
/* (0~31) */
uint8_t g_fixed_addr = 0;
@ -62,25 +91,24 @@ uint8_t g_fixed_addr = 0;
extern volatile uint16_t g_uart1_tx_count; /* UART1 TX 진행 카운트 */
extern volatile uint16_t g_uart0_tx_count; /* UART0 TX 진행 카운트 */
extern volatile uint8_t g_uart0_tx_done;
/* =========================
* RS485 Bridge FIFO
* ========================= */
static volatile uint8_t s_rb_fifo[RS485_BRIDGE_FIFO_SZ];
static volatile uint8_t s_rb_head = 0;
static volatile uint8_t s_rb_tail = 0;
static volatile uint16_t s_rb_head = 0;
static volatile uint16_t s_rb_tail = 0;
void RS485_Bridge_Push(uint8_t b)
{
uint8_t next = (uint8_t)(s_rb_head + 1);
uint16_t next = (uint16_t)(s_rb_head + 1);
if (next >= RS485_BRIDGE_FIFO_SZ) next = 0;
/* FIFO full -> drop oldest (tail++) */
if (next == s_rb_tail) {
uint8_t t = (uint8_t)(s_rb_tail + 1);
uint16_t t = (uint16_t)(s_rb_tail + 1);
if (t >= RS485_BRIDGE_FIFO_SZ) t = 0;
s_rb_tail = t;
}
s_rb_fifo[s_rb_head] = b;
s_rb_head = next;
}
@ -89,14 +117,56 @@ static void RS485_Bridge_ResetFifo(void)
{
s_rb_head = 0;
s_rb_tail = 0;
s_end_st = 0;
g_rs485_bridge_done = 0;
}
static int RS485_Bridge_ReadLine(char *out, int out_sz, uint32_t timeout_us)
{
int n = 0;
while (timeout_us--) {
// FIFO에 데이터가 있으면 1바이트씩 꺼내서 line 구성
while (s_rb_tail != s_rb_head) {
char c = (char)s_rb_fifo[s_rb_tail];
s_rb_tail++;
if (s_rb_tail >= RS485_BRIDGE_FIFO_SZ) s_rb_tail = 0;
if (c == '\r') continue;
if (n < out_sz - 1) out[n++] = c;
if (c == '\n') {
out[n] = '\0';
return 1; // line 완성
}
}
delay_us(1);
}
if (n > 0) { out[n] = '\0'; }
return 0; // timeout
}
static int Is_V_Response_For(char *line, uint8_t addr)
{
uint8_t a;
// line 예: "V02\n" 또는 "V02\r\n" (CR은 위에서 제거됨)
if (line[0] != 'V' && line[0] != 'v') return 0;
if (!isdigit((unsigned char)line[1]) || !isdigit((unsigned char)line[2])) return 0;
a = (uint8_t)((line[1]-'0')*10 + (line[2]-'0'));
return (a == addr);
}
/* =========================
* ? PC(UART1) Safe TX ()
* -
* - R_UART1_Send
* ========================= */
static uint8_t g_uart1_txbuf[128];
static uint8_t g_uart1_txbuf[256];
static void UART1_WaitTxIdle(void)
{
@ -157,7 +227,7 @@ static void RS485_Bridge_DrainToPC(void)
if (g_uart1_tx_count != 0U) return;
/* FIFO -> 임시 버퍼에 최대 64바이트까지 모아서 한 번에 전송 */
while (s_rb_tail != s_rb_head && n < 64U) {
while (s_rb_tail != s_rb_head && n < 256U) {
g_uart1_txbuf[n++] = s_rb_fifo[s_rb_tail];
s_rb_tail++;
if (s_rb_tail >= RS485_BRIDGE_FIFO_SZ) s_rb_tail = 0;
@ -245,6 +315,34 @@ static int parse_x_prefix(const char *s, int len,
return -1;
}
static int bridge_wait_until_end(uint32_t total_us)
{
const char *pat = "<end>";
uint8_t st = 0;
while (total_us--) {
// FIFO -> PC 전송
while (s_rb_tail != s_rb_head) {
char c = (char)s_rb_fifo[s_rb_tail];
s_rb_tail = (s_rb_tail + 1) % RS485_BRIDGE_FIFO_SZ;
// PC로 바로 출력(버퍼링은 기존처럼 모아서 보내도 OK)
// 여기서는 단순화를 위해 1바이트라 가정하지 말고 기존 256모아서 보내는 함수 유지 권장
// 패턴 매칭
if (c == pat[st]) {
st++;
if (pat[st] == 0) return 1; // found
} else {
st = (c == pat[0]) ? 1 : 0;
}
}
delay_us(1);
}
return 0;
}
/* =========================
* Print routing
* ========================= */
@ -307,18 +405,58 @@ static void send_v_response(CmdSource src, uint8_t addr)
resp[5] = '\0';
if (src == CMD_SRC_RS485) {
delay_us(300); // 200~500us 권장 (환경 따라 조정)
delay_us(600); // 200~500us 권장 (환경 따라 조정)
}
OUT_PRINT(src, resp);
}
static void UART0_WaitTxDone_Flag(uint32_t guard_us)
{
while (!g_uart0_tx_done && guard_us--) {
delay_us(1);
}
}
static void RS485_FlushJunk(uint16_t loops, uint16_t step_us)
{
// 스캔 시작 전에, 들어와 있던 CR/LF/노이즈를 PC로 빼고 FIFO도 비움
while (loops--) {
RS485_Bridge_DrainToPC();
delay_us(step_us);
}
}
static void PC_PrintLine_CRLF(const char *line)
{
char tmp[40];
size_t n = strlen(line);
size_t i;
// line이 '\n'로 끝나면, "\r\n"로 보정
if (n > 0 && line[n-1] == '\n') {
size_t m = 0;
for (i=0; i<n && m < sizeof(tmp)-3; i++) {
if (line[i] == '\r') continue;
if (line[i] == '\n') { tmp[m++] = '\r'; tmp[m++] = '\n'; }
else tmp[m++] = line[i];
}
tmp[m] = 0;
UART1_SendString_Safe(tmp);
} else {
UART1_SendString_Safe(line);
UART1_SendString_Safe("\r\n");
}
}
/* =========================
* RS485 scan: xNNv\r\n
* ========================= */
static void scan_one_addr_rs485(uint8_t addr)
{
char cmdline[8];
uint8_t try;
uint8_t i;
if (addr == 0) return;
@ -330,49 +468,64 @@ static void scan_one_addr_rs485(uint8_t addr)
cmdline[5] = '\n';
cmdline[6] = '\0';
// --- bridge 준비 ---
g_rs485_bridge_active = 1;
g_rs485_bridge_done = 0;
RS485_Bridge_ResetFifo();
// RX arm
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
for (try = 0; try < 3; try++)
{
// --- bridge 준비 ---
g_rs485_bridge_active = 1;
g_rs485_bridge_done = 0;
RS485_Bridge_ResetFifo();
// ? (A) 이전 송신이 남아있으면 정리
UART0_WaitTxDone_Us(5000);
// RX arm
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
// ? (B) 송신
RS485_PRINT(cmdline);
RS485_FlushJunk(40, 10); // 400us 정도
// ? (C) “진짜 송신 끝 + RX 전환”까지 대기
UART0_WaitTxDone_Us(5000);
// ? (B) 송신
g_uart0_tx_done = 0;
RS485_PRINT(cmdline);
// ? (D) 턴어라운드 여유 (보드/트랜시버 따라 200~500us 권장)
delay_us(300);
// ? (C) TX 끝 + rs485_set_tx(0)까지 보장 (sendend callback이 set)
UART0_WaitTxDone_Flag(3000); // 3ms 안에 충분
delay_us(30);
// ? (E) 응답 대기 (예: 20ms)
{
uint32_t wait_us = 80000;
while (!g_rs485_bridge_done && wait_us >= 50) {
RS485_Bridge_DrainToPC();
delay_us(50);
wait_us -= 50;
// ? (D) 턴어라운드 (460800이면 100~300us면 충분)
delay_us(120);
{
uint32_t total_wait_us = 4000; // 필요시 20~30ms까지 올려도 됨
char linebuf[32];
while (total_wait_us > 0) {
int got = RS485_Bridge_ReadLine(linebuf, sizeof(linebuf), 2000); // 2ms chunk
if (got) {
// 에코(x02v\n)나 잡음 라인은 무시하고 계속 본다
if (Is_V_Response_For(linebuf, addr)) {
PC_PrintLine_CRLF(linebuf);
g_rs485_bridge_active = 0;
return; // 성공
}
} else {
// 2ms 동안 라인 못 만들었으면 남은 시간 줄이고 계속
}
if (total_wait_us > 2000) total_wait_us -= 2000;
else total_wait_us = 0;
}
}
RS485_Bridge_DrainToPC();
}
g_rs485_bridge_active = 0;
g_rs485_bridge_active = 0;
if (!g_rs485_bridge_done) {
send_n_response(addr);
delay_us(300);
}
// 3번 다 실패하면 Nxx
send_n_response(addr);
// 다음을 위해 RX 재arm
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
}
@ -473,6 +626,8 @@ static void process_one_line(CmdSource src, const volatile uint8_t *rx_buf, uint
char orig_line[UART_RX_BUF_SIZE];
int orig_len = 0;
char msg[64];
s_prefix_mode = PREFIX_NONE;
@ -528,6 +683,13 @@ static void process_one_line(CmdSource src, const volatile uint8_t *rx_buf, uint
uint8_t hash_on = 0;
uint8_t anaout_on = 0;
uint8_t check_on = 1;
uint32_t total_us = BRIDGE_TOTAL_WAIT_US;
uint32_t idle_us = 0;
uint16_t last_seq = g_rs485_bridge_seq;
uint8_t got_any = 0;
int r = parse_x_prefix(line, idx, &addr, &ch, &mode, &hash_on, &anaout_on, &check_on, &payload_pos);
@ -541,71 +703,85 @@ static void process_one_line(CmdSource src, const volatile uint8_t *rx_buf, uint
if (ch < 1 || ch > 20) { OUT_PRINT(src, "Err:ch_range\r\n"); return; }
/* addr mismatch */
if (addr != g_fixed_addr) {
/* 보드1(addr=0) + PC에서만 RS485 중계 */
if (g_fixed_addr == 0 && src == CMD_SRC_PC) {
g_rs485_bridge_active = 1;
g_rs485_bridge_done = 0;
RS485_Bridge_ResetFifo();
if (addr != g_fixed_addr)
{
/* 보드1(addr=0) + PC에서만 RS485 중계 */
if (g_fixed_addr == 0 && src == CMD_SRC_PC)
{
uint32_t total_us;
uint32_t idle_us;
uint16_t last_seq;
uint8_t got_any;
g_rs485_bridge_active = 1;
g_rs485_bridge_done = 0;
RS485_Bridge_ResetFifo();
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
/* ---- RS485로 명령 송신 ---- */
{
static char txbuf[UART_RX_BUF_SIZE + 4];
int n = orig_len;
if (n > (int)sizeof(txbuf) - 3) n = (int)sizeof(txbuf) - 3;
memcpy(txbuf, orig_line, (size_t)n);
txbuf[n++] = '\r';
txbuf[n++] = '\n';
txbuf[n] = '\0';
/* UART0 TX busy면 잠깐 대기 후 송신 */
{
unsigned long g = 0;
while (g_uart0_tx_count != 0U) {
if (g++ > 3000000UL) break;
}
}
RS485_PRINT(txbuf);
}
/* ---- 응답 드레인: “수신이 한 번이라도 있었고”, 이후 3ms idle이면 종료 ---- */
total_us = BRIDGE_TOTAL_WAIT_US;
idle_us = 0;
last_seq = g_rs485_bridge_seq;
got_any = 0;
while (total_us >= 50U) {
RS485_Bridge_DrainToPC();
delay_us(50);
total_us -= 50U;
if (g_rs485_bridge_done) break; // 1) <end>면 종료
if (g_rs485_bridge_seq != last_seq) {
last_seq = g_rs485_bridge_seq;
got_any = 1;
idle_us = 0; // 2) 데이터 들어오면 idle 리셋
} else if (got_any) {
idle_us += 50U; // 3) 한 번이라도 받은 뒤
if (idle_us >= BRIDGE_IDLE_DONE_US) break; // 3ms 무응답이면 종료
}
}
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
RS485_Bridge_DrainToPC();
g_rs485_bridge_active = 0;
{
static char txbuf[UART_RX_BUF_SIZE + 4];
int n = orig_len;
if (n > (int)sizeof(txbuf) - 3) n = (int)sizeof(txbuf) - 3;
memcpy(txbuf, orig_line, (size_t)n);
txbuf[n++] = '\r';
txbuf[n++] = '\n';
txbuf[n] = '\0';
/* (권장) UART0 TX busy면 잠깐 대기 후 송신 */
{
unsigned long g = 0;
while (g_uart0_tx_count != 0U) {
if (g++ > 3000000UL) break; /* 무한 대기 방지 */
}
}
RS485_PRINT(txbuf);
if (total_us < 50U) {
OUT_PRINT(CMD_SRC_PC, "Err:rs485_timeout\r\n");
sprintf(msg, "Err:rs485_timeout fef=%lu ovf=%lu pef=%lu\r\n",
g_uart0_err_fef, g_uart0_err_ovf, g_uart0_err_pef);
OUT_PRINT(CMD_SRC_PC, msg);
}
}
{
/* 시간 기반 대기(us)로 변경: OWT/I2C 동작 포함해서 여유 있게 */
uint32_t wait_us = 80000; /* 80ms (필요시 50~120ms로 조정) */
if (strstr(orig_line, ":OR") || strstr(orig_line, ":or")) {
wait_us = 3000000; // 300ms
}
while (!g_rs485_bridge_done && wait_us >= 50U) {
RS485_Bridge_DrainToPC();
delay_us(50);
wait_us -= 50U;
}
RS485_Bridge_DrainToPC();
g_rs485_bridge_active = 0;
/* 다음을 위해 RX 재arm */
rs485_rx_done = 0;
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t*)&rs485_rx_buffer[0], 1);
if (!g_rs485_bridge_done) {
OUT_PRINT(CMD_SRC_PC, "Err:rs485_timeout\r\n");
}
}
}
return; /* 슬레이브는 addr mismatch 무시 */
}
return; /* 슬레이브는 addr mismatch 무시 */
}
/* addr == g_fixed_addr: 로컬 처리(채널 선택 등) */
if (mode == 'C') {
@ -787,6 +963,7 @@ void main(void)
void R_MAIN_UserInit(void)
{
/* Start user code. Do not edit comment generated here */
EI();
R_PORT_Create();
@ -794,5 +971,7 @@ void R_MAIN_UserInit(void)
DipSwitch_Init();
g_fixed_addr = DipSwitch_ReadAddr_0to31();
/* End user code. Do not edit comment generated here */
}
/* End user code. Do not edit comment generated here */

2
r_systeminit.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements system initializing function.
* Creation Date: 2026-01-30
* Creation Date: 2026-02-04
***********************************************************************************************************************/
/***********************************************************************************************************************

4
uart.c

@ -124,7 +124,7 @@ void uart_send_hex(uint8_t val)
rs485_set_tx(1);
R_UART0_Send(hex, 2);
delay(10000);
}
void uart1_send_hex(uint8_t val)
@ -137,7 +137,7 @@ void uart1_send_hex(uint8_t val)
hex[1] = (low < 10) ? ('0' + low ) : ('A' + (low - 10));
R_UART1_Send(hex, 2);
delay(10000);
}

4
uart.h

@ -15,6 +15,10 @@ void UART0_WaitTxDone_Us(uint32_t timeout_us);
#define RAM_BYTES 13
#define UART_RX_BUF_SIZE 256
extern volatile uint32_t g_uart0_err_fef;
extern volatile uint32_t g_uart0_err_ovf;
extern volatile uint32_t g_uart0_err_pef;
// PC(USB, UART1) 출력 전용
#define PC_PRINT(s) uart1_send_string((s))
#define PC_PRINT_HEX(v) uart1_send_hex((v))

Loading…
Cancel
Save