cancel
Showing results for 
Search instead for 
Did you mean: 

CANBUS nmea 2000 phrase protocol packet on STM32

TBen .1
Associate

I have STM32 microcontroller F4 I want to configure the GPS sensor for getting data, I used CANBUS cable and the protocol is nmea 2000, and communicate with HAL_CAN interrupt. my question is, how can I phrase the data from the sensor (on nmea 2000). I want to get data from PGN 127257, I need to transmit data (PGN 127257) for reading? or only phrase the data, and if phrase how?

thanks a lot!

void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan){

HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RXheader, an_packet.NemaData);

u32_2b.bytes[0] = an_packet.NemaData[0];

u32_2b.bytes[1] = an_packet.NemaData[1];

u32_2b.bytes[2] = an_packet.NemaData[2];

u32_2b.bytes[3] = an_packet.NemaData[3];

mid1 = u32_2b.data;

mid = (mid1 >> 8) & 0x01ffff;

if((mid == 126992) || (mid == 127257) || (mid == 127252) || (mid == 129540)) {

GPS.test1 = 5;

}

}

an_packet.NemaData = getting data from the sensor.

u32_2b.bytes[0] = an_packet.NemaData[0];

u32_2b.bytes[1] = an_packet.NemaData[1];

u32_2b.bytes[2] = an_packet.NemaData[2];

u32_2b.bytes[3] = an_packet.NemaData[3];

mid1 = u32_2b.data;

mid = (mid1 >> 8) & 0x01ffff;

if((mid == 126992) || (mid == 127257) || (mid == 127252) || (mid == 129540)) {

GPS.test1 = 5;

}

trying to phrase it...

0 REPLIES 0