cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 code documentation locations

OIp.1
Associate III

Hi. I am currently using the STM32756-EVAL board for some embedded programming. So far, for reference, I am using:

  • PM0253 Programming manual - STM32F7 Series and STM32H7 Series Cortex®-M7 processor programming manual
  • UM1905 - Description of STM32F7 HAL and low-layer drivers - User manual
  • RM0385 - STM32F75xxx and STM32F74xxx advanced Arm®-based 32-bit MCUs - Reference manual

These are all decently useful for understanding the drivers, the capabilities and limitations of STM32756-EVAL. It is, however, less useful in explaining the C code. Take this code for example:

uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
  uint8_t result = USBD_OK;
  /* USER CODE BEGIN 7 */
  USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;  //What is hUsbDeviceFS? How does it have pClassData?
  if (hcdc->TxState != 0){	//If TxState in hcdc is not 0, return USBD_BUSY. What is hcdc?
    return USBD_BUSY;
  }
  USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);	//What does SetTxBuffer mean?
  result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);	//What does USBD_CDC_TransmitPacket(&hUsbDeviceFS) mean?
  /* USER CODE END 7 */
  return result;
}

None of my instruction manuals give me any indication on what any of the code actually does other than in the broadest strokes. They do not explain what terms like USBD_CDC_TransmitPacket or hUsbDeviceFS are, and while I can guess from context what they do, I would be stumped when it comes to "new" capabilities that I would have to add without preexisting, named code.

In other programming packages like Qt or Selenium there is usually documentation on what the terms in the code are, so something like "QTableView", an oddly specific term used in Qt, would have it's own code documentation page. It is thanks to this page that I know in order to add a table, I need to use something called a QTableView and not a QTable, QTablePlacer, Table, TablePutter, or any other term that makes sense without the documentation. https://doc.qt.io/qt-6/qtableview.html

What I am trying to locate is a document, online or pdf, which would document all the potential objects that anyone programming in C could use in their code. Please let me know if more information is required.

5 REPLIES 5
Javier1
Principal

>>What I am trying to locate is a document, online or pdf, which would document all the potential objects that anyone programming in C could use in their code. Please let me know if more information is required.

If you do find something like that , please rely it to me.

Ive been doing mcu programming for almost 7 years now, and that piece of code (CDC_Transmit_FS

) is as good as it gets.

Crap. In any case, thank you for letting me know.

In that case, is the act of embedded programming just a long series of informed guesses on what the potentially appropriate variable/function name is? What can be done to improve the efficiency of these informed guesses?

What i do is usually work with examples provided by the manufacturer and dense Reference manual readings, spiced up with real time debugging , trial and error. (if we are talking about HAL libraries)

There is no "ctrl+F1" , HAL libraries are more or less commented in their respective .c files.

I do have the feeling the embedded world is 20years behind normal software developing trends, i feel like its way harder than it should be.

Also as the distance from firmware and real hardware gets thinner, there is a high level of code customization, everything could be done in a million different ways.

Pavel A.
Evangelist III

Here you can find help with [simple] STM32 projects. Skip suffering and confusion right to the meat of your project.

> I do have the feeling the embedded world is 20years behind normal software developing trends

chatgpt is going to fix this soon. no worry ))