Skip to content

How to implement LSS Slave/Master #102

Description

@l13433166-ui

It's very smooth to use NMT SDO PDO while canOpenNodeSTM32.desiredNodeID is valid (1-127)。

I tried to implement LSS Slave/Master to set node id。

This is my code

int main(void) {

	/* USER CODE BEGIN 1 */

	/* USER CODE END 1 */

	/* MCU Configuration--------------------------------------------------------*/

	/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
	HAL_Init();

	/* USER CODE BEGIN Init */

	/* USER CODE END Init */

	/* Configure the system clock */
	SystemClock_Config();

	/* USER CODE BEGIN SysInit */

	/* USER CODE END SysInit */

	/* Initialize all configured peripherals */
	MX_GPIO_Init();
	MX_CAN_Init();
	MX_TIM2_Init();
	/* USER CODE BEGIN 2 */
	HAL_TIM_Base_Start_IT(&htim2);
	OD_PERSIST_COMM.x1018_identity.vendor_ID = 0x7b;
	OD_PERSIST_COMM.x1018_identity.productCode = 0x00000001;
	OD_PERSIST_COMM.x1018_identity.revisionNumber = 0x00000001;
	OD_PERSIST_COMM.x1018_identity.serialNumber = *(uint32_t*) UID_ADDR_F103;

	CANopenNodeSTM32 canOpenNodeSTM32;
	canOpenNodeSTM32.CANHandle = &hcan;
	canOpenNodeSTM32.HWInitFunction = MX_CAN_Init;
	canOpenNodeSTM32.timerHandle = &htim2;
	canOpenNodeSTM32.desiredNodeID = 0x00;
	canOpenNodeSTM32.baudrate = 500;
	canopen_app_init(&canOpenNodeSTM32);
	/* USER CODE END 2 */

	/* Infinite loop */
	/* USER CODE BEGIN WHILE */
	while (1) {
		/* USER CODE END WHILE */

		/* USER CODE BEGIN 3 */
		OD_RAM.x6002_T1 = (OD_RAM.x6002_T1 + 1) % 1000;
		OD_RAM.x6003_T2 = OD_RAM.x6004_R1 + OD_RAM.x6005_R2;
		canopen_app_process();
	}
	/* USER CODE END 3 */
}

and I also set

#define CO_CONFIG_LSS (CO_CONFIG_LSS_SLAVE )
#define CO_CONFIG_LSS_SLAVE 0x01
#define CO_CONFIG_LSS_SLAVE_FASTSCAN_DIRECT_RESPOND 0x02
#define CO_CONFIG_LSS_MASTER 0x10

in CO_config.h

#define OD_CNT_LSS_SLV 1

in OD.h

no response from node while I manually send frame like a LSS master

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions