Hi
How do I define the serial port that I will use on the STM32CubeIDE to connect to a power meter with an optical probe?
This is my code and I have two usb serial ports:
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART2_UART_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
GXTRACE_INT(GET_STR_FROM_EEPROM("Start application"), NULL);
BYTE_BUFFER_INIT(&frameData);
//Set frame capacity.
bb_capacity(&frameData, 128);
Client.init(true, 16, 1, DLMS_AUTHENTICATION_HIGH_GMAC, NULL, DLMS_INTERFACE_TYPE_HDLC_WITH_MODE_E);
//Un-comment this if you want to set system title, block cipher key or authentication key.
Client.SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);
//TODO: Change logical name of the frame counter if it's used to com_readAllObjects.
gxByteBuffer bb;
bb_init(&bb);
bb_addHexString(&bb, GET_STR_FROM_EEPROM("1234560005000001"));
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, GET_STR_FROM_EEPROM("00 00 63 65 6C 31 32 33 34 35 36 37 38 39 00 00"));
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, GET_STR_FROM_EEPROM("00 00 63 65 6C 31 32 33 34 35 36 37 38 39 00 00"));
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);
Thanks
Fabiano
Hi Fabiano, You need to…
Hi Fabiano,
You need to implement UART reading and writing. CHeck MX_USART2_UART_Init. It will describe what PINs you should use.
BR,
Mikko