cancel
Showing results for 
Search instead for 
Did you mean: 

increase cycle time

NAkku.1
Associate III

I have rfid and can working. I want to do is increase the cycle time for can so it is not too fast. Right now i am getting 0.3 cycle time and when i add the HAL_Delay(200) it increases the cycle time but the rfid slows down. Any suggestions what i can do?

What i want to do is send the rfid reading over the CAN when nfcv is detected if not detected then send zero's only.. When i add HAL_Delay(200) the entire system gets the delay i only want to add that to can transmission. Please guide me. I am very new to stm32

1 ACCEPTED SOLUTION

Accepted Solutions

this is the solution for this. Topic resolved

if(&nfcDevice->dev.nfcv)
                {
                    platformLedOn(PLATFORM_LED_V_PORT, PLATFORM_LED_V_PIN);
                	while (rfalNfcvPollerInventory( RFAL_NFCV_NUM_SLOTS_1, RFAL_NFCV_UID_LEN * 8U, nfcDevice->dev.nfcv.InvRes.UID, &invRes, &rcvdLen) == ERR_NONE)
                	{
                	  platformDelay(500);
                	  HAL_CAN_AddTxMessage(&hcan1, &TxHeader,  nfcDevice->nfcid, &TxMailbox);
                	}
                }

View solution in original post

3 REPLIES 3
Brian TIDAL
ST Employee

Hi,

you can try something like:

tickStart = HAL_GetTick();

if( (HAL_GetTick() - tickStart) > yourDesiredCanCyclePeriod-i.e._200)

{

yourCanCycle()

tickStart = HAL_GetTick();

}

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I tried it but it didn't work. I want to constantly send zeros through can but when nfcv is detected then send the uid over can. here is what i did. the first part is in democycle function and the last part is in the main function.

 if(&nfcDevice->dev.nfcv)
                {
                	HAL_CAN_AddTxMessage(&hcan1, &TxHeader,  nfcDevice->nfcid, &TxMailbox);
 
                }
 
CAN_TxHeaderTypeDef TxHeader;
CAN_RxHeaderTypeDef RxHeader;
uint8_t TxData[8] = {0,0,0,0,0,0,0,0};
uint32_t TxMailbox;
 
if((HAL_GetTick()- tickstart) > 200)
		{
			HAL_CAN_AddTxMessage(&hcan1, &TxHeader, TxData, &TxMailbox);
			tickstart = HAL_GetTick();
		}

this is the solution for this. Topic resolved

if(&nfcDevice->dev.nfcv)
                {
                    platformLedOn(PLATFORM_LED_V_PORT, PLATFORM_LED_V_PIN);
                	while (rfalNfcvPollerInventory( RFAL_NFCV_NUM_SLOTS_1, RFAL_NFCV_UID_LEN * 8U, nfcDevice->dev.nfcv.InvRes.UID, &invRes, &rcvdLen) == ERR_NONE)
                	{
                	  platformDelay(500);
                	  HAL_CAN_AddTxMessage(&hcan1, &TxHeader,  nfcDevice->nfcid, &TxMailbox);
                	}
                }