Page 1 of 1

[solved] UART problem

Posted: Tue May 17, 2016 11:28 am
by STibor
Hello!

I use 1 pc. RS232 hardware macros, and should 9pcs. RS232 software macro. (9 pieces. DFPlayer + RS485 Modbus)
Unfortunately, the program does not compile vain changed the CAL file.
Up to 8 pieces. RS232 component can be used.
What can be wrong?
How many RS232 can be used for many components?

Re: UART problem

Posted: Tue May 17, 2016 12:11 pm
by Benj
Hello,

Yes we have only allowed support for up to 8 UARTs channels but this is easy to expand.

The limitation is in the "CAL/includes.c" file.

The end of the file looks like this.

Code: Select all

#ifdef	MX_UART_REF8
  #define MX_UART_NUM 8
  #ifdef MX_CAL_PIC
	#include "PIC\PIC_CAL_UART.c"
  #endif
  #ifdef MX_CAL_PIC16
	#include "PIC16BIT\PIC16BIT_CAL_UART.c"
  #endif
  #ifdef MX_CAL_AVR
	#include "AVR\AVR_CAL_UART.c"
  #endif
  #ifdef MX_CAL_ARM
	#include "ARM\ARM_CAL_UART.c"
  #endif
  #undef MX_UART_NUM
#endif
#ifdef CALFUNCTION
	#undef CALFUNCTION
#endif
if you add this section before the #ifdef CALFUNCTION line then this should allow for up to 10 UARTs.

Code: Select all

#ifdef	MX_UART_REF9
  #define MX_UART_NUM 9
  #ifdef MX_CAL_PIC
	#include "PIC\PIC_CAL_UART.c"
  #endif
  #ifdef MX_CAL_PIC16
	#include "PIC16BIT\PIC16BIT_CAL_UART.c"
  #endif
  #ifdef MX_CAL_AVR
	#include "AVR\AVR_CAL_UART.c"
  #endif
  #ifdef MX_CAL_ARM
	#include "ARM\ARM_CAL_UART.c"
  #endif
  #undef MX_UART_NUM
#endif
#ifdef	MX_UART_REF10
  #define MX_UART_NUM 10
  #ifdef MX_CAL_PIC
	#include "PIC\PIC_CAL_UART.c"
  #endif
  #ifdef MX_CAL_PIC16
	#include "PIC16BIT\PIC16BIT_CAL_UART.c"
  #endif
  #ifdef MX_CAL_AVR
	#include "AVR\AVR_CAL_UART.c"
  #endif
  #ifdef MX_CAL_ARM
	#include "ARM\ARM_CAL_UART.c"
  #endif
  #undef MX_UART_NUM
#endif