We wanted to do a replacement for an old profibus DP device and I found this repository which is easy transformer to ESP-IDF or PicoSDK. It does what I need successfully, Thanks a lot! I encountered two issues in use, as follows:
1, Line 689 need replace to profibus_send_CMD(SD2, DATA_LOW, 0, &uart_buffer[7], Output_Data_Size); // send data
|
#if (OUTPUT_DATA_SIZE > 0) |
|
if (diagnose_status == true) |
|
profibus_send_CMD(SD2, DIAGNOSE, 0, &uart_buffer[7], 0); // Request a diagnosis |
|
else |
|
profibus_send_CMD(SD2, DATA_LOW, 0, &uart_buffer[7], Input_Data_size); // send data |
2, Here just accept function code = 0x5D or 0x7D, but 0x6D also is a good function code.
According https://www.felser.ch/profibus-manual/funktionscode.html, 0x6D is first frame with FCV. For our application, we don't have to strictly follow the protocol, we just need to add 0x6D to the if then it works well.
|
else if (function_code == (REQUEST_ + FCV_ + SRD_HIGH) || |
|
function_code == (REQUEST_ + FCV_ + FCB_ + SRD_HIGH)) |
|
{ |
cheers
We wanted to do a replacement for an old profibus DP device and I found this repository which is easy transformer to ESP-IDF or PicoSDK. It does what I need successfully, Thanks a lot! I encountered two issues in use, as follows:
1, Line 689 need replace to
profibus_send_CMD(SD2, DATA_LOW, 0, &uart_buffer[7], Output_Data_Size); // send dataArduino_Profibus_DP/Arduino_Profibus_DP.ino
Lines 685 to 689 in d460338
2, Here just accept function code = 0x5D or 0x7D, but 0x6D also is a good function code.
According https://www.felser.ch/profibus-manual/funktionscode.html, 0x6D is first frame with FCV. For our application, we don't have to strictly follow the protocol, we just need to add 0x6D to the if then it works well.
Arduino_Profibus_DP/Arduino_Profibus_DP.ino
Lines 662 to 664 in d460338
cheers