Thank you for your interest about this blog and its author. My name is Carmine Noviello. I'm a manager, an embedded programmer and hardware designer in Italy. I live in the south of Italy, in Caserta.
I started playing with computer since I was less than ten years. I started having fun with the first PCs in the '80 and, day-by-day, I've translated a passion in my work. Different from other programmers, I started coding with a language not so common at that time: Clipper. I still don't know why I decided to learn that programming language. Probably, the main reason is that Clipper was used as a language for relational systems (especially DBASE III) and then for the development of software for banks management. And this was really mainstream at that time.
For many years I've developed several programs in Visual Basic (one of them - a program for patients management for medical doctors - reached the market too) until I began attend the college, where I started programming in Unix environments and other programming languages like C/C++. But one day I discovered what would become the programming language of my life: Python. I've written thousands of hundreds of lines of code in Python, ranging from web systems to embedded devices. I think that Python is the most expressive and productive programming language than ever, and it's always my first choice when I've to code something.
For about ten years I worked at National Research Council in Italy (CNR) as research assistant, where I spent my time coding web-based and distributed content management systems. In 2010 my professional life has changed dramatically. For several reasons that I'm not here to enumerate, I found myself catapulted into a world I had always considered obscure: electronics. I started first developing firmware on low-cost MCUs, and then designing custom PCBs. Meanwhile I founded a company that offers consultant in embedded wireless systems.
In 2015 I started writing a book about STM32 microcontrollers, and in 2022 I published the second edition too. The book it is published through the LeanPub platform, which allows to publish in-progress books. I started writing it just for fun. And now it is considered the best book about this subject. A lot of universities, companies and individuals use it as main reference of this exciting MCU portfolio. And this is probably one of the things I'm most proud of in my life. Sometimes things just happen. By chance.
In recent years my professional career evolved towards a management role. Since three years, I'm a Business Unit director in one of the most relevant companies operating in the Digital Trust industry. I rule the business of hardware devices, made of smartcards, smart card readers, PKI tokens. It's a challenging job, especially when you have to expand the business, but it's also very rewarding. I've the privilege to guide a very skilled team of people, ranging from HW designers to software developers. It's tough, but also very rewarding.
70 comments
Ciao Carmine,
sto partendo con una nuova startup nel settore della robotica (aria/terra/acqua) e cerco collaborazioni nel settore programmazione STM32. È un settore che ti potrebbe interessare?
In attesa di un tuo gentile riscontro.
Saluti,
LKB
Ciao,
scusami per il ritardo nella risposta, ma ho avuto problemi con la mail, e non ho ricevuto le notifiche.
La cosa potrebbe interessarmi, ma dipende dal progetto e dal tipo di collaborazione che cerchi. Sentiamoci in privato tramite il mio indirizzo di posta cnoviello @ hotmail.com
Ciao Carime,
questa volta scusami te, non avevo mai ricevuto una notifica della tua risposta e sono ora ricapitato quí per caso, e ho letto la tua risposta.
Sto partendo con un progetto open source di un autopilota safety critical per droni basato su Ada-SPARK e STM32. Per questo progetto sono in cerca di partecipanti.
Questo il sito (work still in progress) adapilot.likeabird.eu
Ho provato a spedirti una mail sulla tua hotmail, ma mi torna indietro dichiarata blocked. Ti lascio la mia: relaxibus @ akfree.it
A presto,
Jarno
Can I connect to a STM32f4 Discovery with the QSTLink2? Your book has been extremely helpful but I don't have the Nucleo board :/ When I try to run QSTLink2 with my board, it says "Device not found in database!". Does this mean my board is not supported by QSTLink2? Thanks
Hi, Just bought your book. Thnx for providing a book on ST's HAL. It seems that the info on the web is very spare and incorrect.
Two things.
If possible add the complete table of content to your demo book. I almost didn't buy the book as I couldn't find enough info in the TOC to convince me to but it. Only once I went through the code on Github did I realise that the book is a good buy. I later saw the TOC on the web site.
You may have answered the following in your book. If you haven't it might be something to add.
1) I want to do a FFT, which requires precise timing in the ADC samples. To reduce the overheard of interrupts it is best to use DMA. Therefore is there an example that triggers the ADC from a timer and once a buffer is loaded with x amount of samples will it generate an interrupt to notify the user?
2) What about custom bootloader. What is one would like to do over the air updates by dumping the image into an external flash device from which the ST processor can be programmed.
Again, thnx for the effort that has gone into writing the book.
Hi,
Thank you for supporting my project.
Regarding your questions:
1) This topic is covered in the latest release 0.12 (released two days ago) in paragraph 12.2.8.
2) This topic will be covered later, probably in a couple of months, because I've to cover other preliminary topics before it.
Hey Carmine,
Learning a lot from your blog entries & your book, thanks!
Any ETA on a tutorial to setup an environment without eclipse? You mentioned in one of your article you would write something about setting up everything using vim, gdb, openocd etc.!
Regards,
Arthur
I have the same issue on the STM32F091RC Nucleo
Ho solo 3 parole per definire il tuo blog: Manna dal cielo.
Lavoro con i microcontroller da pochi anni e mi ci sono avvicinato grazie ad Arduino.
Adoro l'AVR ma credo sia il momento di passare ad ARM.
Ho comprato un po' di libri su M0(+) e M3-4 ma non ho ancora avuto il tempo.
Settimana scorsa mi sono finalmente deciso a comprare un po' di dev boards.
Ho preso due NXP (M0 e M3) e una STM32f303 su Farnell... sono andato un po' a caso.
Fortunatamente avevo gia lavorato con Eclipse in passato, lo usavo per sviluppare AS2/3 e anche per un paio di progetti con AVREclipse, ma ovviamente l'approccio ad una nuova piattaforma e tutti i tools necessari in questo IDE è sempre un po' ostico.
Il fatto che tu lavori su Mac cambia le carte in tavola: non puoi usare IAR o Keil e hai deciso di scrivere un libro che copre STM32 in Eclipse.
Probabilmente ti farò una statua, ma per ora compro il tuo libro 🙂
Ah, mi presento:
Sono Ubi de Feo (al tempo Ubaldo), sono di Agropoli ma da 13 anni vivo e lavoro ad Amsterdam.
Mi occupo di Interaction Design ed insegno fondamenti di elettronica e Physical Computing in un paio di scuole in giro per l'Europa.
Grazie per l'impegno che metti in questo blog che dovrò consumare nel giro di pochi giorni.
A presto
ubi
Mi sento di fare un'aggiunta 🙂
Ho iniziato a leggere il tuo libro e questa frase mi ha reso felice: "“It is strongly suggested to integrate it with a book about the ARM Cortex-M architecture, and the series from Joseph Yiu it is the best source for every Cortex-M developer.”
Sono esattamente i libri che ho comprato per M0(+) e M3/4.
Bei mattoni, e credo che grazie al tuo libro sarà più facile per me iniziare quest'avventura.
Alla fine come dici tu Arduino nasconde tanto di quello che succede dietro le quinte. Io sono amico di Massimo e ho collaborato con loro come docente di Arduino (ancora oggi), ma la curiosità mi ha spinto a leggermi i datasheets della serie AVR grazie alla quale ho imparato tanto.
Grazie per il tuo sforzo, se capiti ad Amsterdam spero di poterti offrire un caffè (buono).
u.
Ciao Ubaldo,
ti ringrazio tantissimo per le parole di incoraggiamento ^__^. Scusami per il ritardo nelle risposte, ma essendo in ferie ho cercato di staccarmi il più possibile dal mio avatar digitale 😀
Salve Carmine,
ho letto un suo articolo molto interessante, che poi lei ha riportato anche in un paragrafo dell'ebook "mastering stm32" riguardante la generazione di delay a microsecondi con STM32.
L'esempio che lei riporta nel suo articolo si basa sulla sintassi di GCC "asm volatile {...}".
Io uso KEIL da poco e non riesco a trovare un modo equivalente.
Sa darmi una indicazione?
Grazie
Ciao,
scusami il ritardo. Non ho purtroppo esperienza col Keil, ma dovrebbe essere qualcosa di molto simile. Prova a dare uno sguardo qua:
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124246903.htm
Carmine,
Thank you for all of your efforts to make this information available. I was able to figure out the essence of working with my board in an afternoon and it would have maybe been weeks if not a month if I had to do it from scratch on my own. I was especially pleased that the sections had easy to follow directions and an explanation of what was going on to make sense of the step be step directions so I could learn the intricacies of the board.
I unfortunately will not be able to use the board for the intended project, Using your book allowed me to find this out in a very short time. I will have to find another project to use my board on. Thank you very much.
Hi Carmine, Can you please tell us with the current released version of your book which are the parts that are missing/not yet written?
I have to cover RTC and Ethernet applications with the W5500 chip.
Carmine, what is your opinion of this post? Is it exaggerated or true?
https://devzone.nordicsemi.com/question/70721/crossworks-vs-embedded-studio-difference/
I've no experience with those IDEs, but using Eclipse+GNU ARM Eclipse plug-ins, which support JLink natively, can give you the same debug experience.
Hi Carmine,
I had purchased Nucleo F429ZI board about two months back for developing ethernet based application for my client. I have written code for the same and struggling to make it work but not successful so far. I am using FreeRTOS and LWIP tcp-ip stack and generated code with suitable modification using STM32CubeMX. I am able to build on Eclipse and not able to see ETH Interrupt thru HAL_ETH_RxCpltCallback in my ethernetif.c.
About a week back I came across your web site and purchased your book Mastering-STM32.pdf. I was hoping to get some ethernet based example but I could not find it in your book. I must say that your book is very useful and learnt many new concepts about programming STM32 microcontrollers. I am ready to send you my complete project file if you wish but don't wish to bother you with the code. Can you please suggest reading material for solving ethernet related programming issues ?
I tried you Ping example (after modification for my board) in standalone - LWIP and FreeRTOS-LWIP on my board but even that is not working. I will highly appreciate your suggestion about ethernet related programming for Nucleo F429ZI.
Kamlesh J Gandhi
Senior Technical Software Professional
Hi Carmine,
The PING was not working on Nucleo F429ZI because STM32CubeMX was generating code for Phy DP83848 instead of Phy LAN8742A. The latest update of STM32CubeMX has fixed this problem. Now the LWIP socket program exchanging data with Window 10 PC is also working fine.
Kamlesh J Gandhi
Dear Mr Noviello,
I am very interested in your book Mastering STM32. It gives me almost all about STM32 family and CubeMX tool.
One thing that I wondering most is how CubeMX generates code. I mean when I click and choose function for a pin or add some middleware into project, how does CubeMX put those configurations into files?
I am very appreciated if you can show me the know-how or some resources that describe in detail this code-generation process.
Many thanks,
Hi!
I bought your book and its great. I'm using UART protocol and reading at page 228 (release 0.22) when I found EIA-RS484 that I never heard before. Should it be EIA RS-485?
BR
Wagner
Yes. That's typo. Thank you.
Buon giorno Carmine,
I am new to this microcontroller domain and very interested in getting your book.
But before proceeding further to get one, I have the following question :
1. Do the explanation and examples work correctly with STM32F429I Discovery board ? As for the IDE, I have been using Eclipse from AC6 (France), so I think that it should be okay.
Thank you in advance for your reply, and enjoy your day.
Best regards,
Sujito
The book doesn't cover that specific MCU. However, my book teaches you concept, and it should be easy to start using it. The book doesn't cover the AC6 toolchain, but it's a lot similar to the GNU ARM Eclipse plugin toolchain covered in the text.
Hi, Carmine thank you for writing this book! This completely illuminated and connected the dots in an area that was completely opague to me as someone without a engineering background. I actually had it printed so I can hold it in my hand, it's pretty massive but also beautiful with the colored illustrations. I was wondering do you know if STM and/or their engineers are aware of your book? I also see on your site that you are a big python guy. I myself am of the same sentiment. I was wondering if you have spent any time with micropython?
Ciao, ho acquistato in questi giorni il libro perché mi è piaciuta l'esposizione e la completezza degli argomenti.
Unico neo è l'ide basata su eclipse...attualmente sono cambiati sia la versione di eclipse che dei compilatori che dei plugins arm.
Premesso che ho testato l'ambiente sulla serie F1 (un tuo post diceva che i templates fanno riferimento alla spl e non alla hal e quindi potrebbero esserci problemi) e non sono riuscito a compilare nulla senza errori, sarebbe quindi bello che aggiornassi il capitolo con i componenti attuali (è la filosofia leanpub, no?) o che dedicassi per lo meno un post sull'argomento.
Grazie, spero di poter abbandonare ewarm 😉
Dir sir.
thank for your good book mastering stm32
i need to program sd card by HAL SD generic driver in my stm32f103 micro and see um1850 but it not clear for me,help me pls for writing this program;
thanks
areza alikhani
engneer
isfahan-iran
For the ones like my self that prints the part of the book that we are working on and then you do an update, this would work better: Make patches, for a page correction send out a corrected page with both sides the patch number would be the same and if you needed to add more than a page, use the same page number with a letter. This way the we do not have the page numbers mixed up with what we have. You may have to add to the index, just send a new index with the page and letter (this may require a patch foe the index as well if their are several entries. For a chapter patch like last time use a combination of numbers and letters such that the page numbers correspond to the next chapter. This be easer for you to correct the book but you would have to send out a list of patches. For major revision you all ready know what to do.
Also place the URL's in the body of the text if it is were you want us to go, not in the foot note which should be used for reference.
See page iii line 9 change cold to old.
See page 54 "The next four paragraphs, and their sub-paragraphs, are almost identical." Chang the words paragraphs to sections. Why, for example there are three paragraphs on this page.
Correction:
See page 54 "The next three paragraphs, and their sub-paragraphs, are almost identical." Chang the words paragraphs to sections. Why, for example there are four paragraphs on this page.
I just started to down load the software and am confused. Is java 9 SE JDK the latest up grade for Java 9 SE that is mentioned on page 54? If not there are several Java 8's: Java 8 SE JDK,
java SE Embedded Bu 151, and JDK bu151 for ARM, which?
Thank you,
ƒg
Change foot note 11 and 12 page 63 by removing "-" between tool and chain. Also inside "download section".
Chang foot note 11 and 12, remove "-" between tool and chain and al so inside of "download section".
Page 97 paragraph 3 change "paragraphs" to "sections" and paragraph 5 Change "paragraph" to "section".
Ciao Carmine, ho acquistato il tuo libro Mastering STM32, vorrei sapere se ve ne è una versione in italiano. Grazie, Mariano
Ciao Mariano, no: non prevedo di realizzare una traduzione in italiano.
Hello Carmine, I just bought the Mastering STM32 book from Leanpub today!
I have been working with STM32 for a few years, but I can still find a lot to learn from the book!
Thank you so much for writing such a good book!
Hi Carmine, I had bought the Mastering STM32 book through Leanpub too.
I need a help to clarify my problem of using semihosting with C standard Library,
I follow the step as below:
--------------------------------------------------------------------------------------------------------------
To enable it, go to Project->Properties menu. Next go inside the C/C++ Build->Settings
section. In the Optimization section, uncheck the entry Assume freestanding environment (-
ffreestanding). Click on the OK button, go to Project->Clean.. and rebuild the whole project.
------------------------------------------------------------------------------------------------------------
But I have some error message of debug window just like below: (example: src/main-ex2.c)
fd error:
=========================
Multiple errors reported.
1) Failed to execute MI command:
-var-create - * fd
Error message from debugger back end:
value has been optimized out
2) Unable to create variable object
3) Failed to execute MI command:
-var-create - * fd
Error message from debugger back end:
value has been optimized out
===========================
I think I'm going to finish CH2~CH5 about toolchain setting, but I'm blocked on this problem for a while,
Could you give me some advice to solve this? My using OS is Windows 10.
If you need more information about this, please let me know through the e-mail.
Very appreciate
Buongiorno Carmine,
mi sto avvicinando al mondo STM32 e l'intenzione è di partire con il piede giusto utilizzando delle fonti e testi adeguati così come degli strumenti e tools HW/SW che possano essere affidabili ed efficienti. Pertanto sto considerando l'acquisto del suo libro per ciò che concerne la documentazione mentre ho visto che ST ha recentemente acquisito Atollic, rilasciando in modo gratuito la suite di sviluppo per tutti i micro e le schede di valutazione del brand. Ritiene questo un valido strumento? Le informazioni contenute nel suo libro sono ugualmente valide anche utilizzando i suddetti strumenti di TrueStudio?
Grazie in anticipo per la cortese risposta che vorrà fornirmi.
Ciao Carmine, ho una Discovery board STM32 F407VG, secondo te ho problemi a seguire il tuo libro Mastering STM32 con questa scheda?
Hi Carmino,
I'm a beginner with NUCLEO-F303RE board. I follow the steps in the chapter "2.2.1 Windows - Eclipse Installation" with WinXP. Everything goes well with Run project (no errors reported), launching OpenOCD with Windows Command Line tool. But when I run Debug in Eclipse (Oxygen 3a), it starts and does not finish after reaching 79%; last line in Task pane shows: XXX Register index, Resource: stm32f3xx_hal_rcc.h, Line 644. Could you please give me some advice to solve this?
hOur company offers a wide variety of non prescription drugs. Take a look at our health portal in case you want to to feel healthier with a help of health products. Our company provides a wide variety of non prescription drugs. Take a look at our health site in case you want to look healthier with a help health products. Our site offers a wide variety of non prescription drugs. Look at our health portal in case you want to strengthen your health with a help of health products. Our company offers a wide variety of non prescription products. Take a look at our health portal in case you want to to feel healthier with a help of general health products. Our company offers herb-based weight loss products. Visit our health contributing site in case you want to feel better. Our site offers a wide variety of non prescription drugs. Take a look at our health site in case you want to look better with a help health products.
Our company offers a wide variety of non prescription drugs. Take a look at our health website in case you want to strengthen your health with a help of general health products. Our company provides a wide variety of non prescription products. Visit our health website in case you want to to feel healthier with a help health products. Our site offers a wide variety of non prescription drugs. Take a look at our health website in case you want to strengthen your health with a help general health products. Our company provides a wide variety of non prescription drugs. Look at our health portal in case you want to feel better with a help health products. Our company provides a wide variety of non prescription drugs. Look at our health site in case you want to to improve your health with a help health products.
Hello Carmine,
I'm new to the programing world and ST32 chipsets. I download your book and followed step by step.
It looks like there is a bug in the GCC recommended to download on page 61
Name: GNU MCU Eclipse Plug-ins
Location: http://gnu-mcu-eclipse.netlify.com/v4-neon-updates
There are some forums that talk about issue with the 64bit compatibility.
I got this message of error at the end of the build process:
Invoking: GNU ARM Cross Create Flash Image
arm-none-eabi-objcopy -O ihex "hello-nucleo.elf" "hello-nucleo.hex"
arm-none-eabi-objcopy: hello-nucleo.hex 64-bit address 0x4b4fa308000000 out of range for Intel Hex file
arm-none-eabi-objcopy:hello-nucleo.hex: bad value
make: *** [makefile:70: hello-nucleo.hex] Error 1
Appreciate if you can suggest how to resolve the issue or where to download the correct GCC tool?
Thanks,
Avi
Hello Carmine and Avi,
I have exactly the same error and would similarly appreciate guidance on how to solve the problem. Tried many versions but all have failed. Below is the best version I've found but it still fails. I'm completely stuck at this point and don't know what else to try.
I'm using version:-
20190101-2023-gnumcueclipse-4.5.1-2018-12-R-win32.win32.x86_64.zip
Downloaded from:- https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
Invoking: GNU ARM Cross Create Flash Image
arm-none-eabi-objcopy -O ihex "test2.elf" "test2.hex"
arm-none-eabi-objcopy: test2.hex 64-bit address 0x4b4fa308000000 out of range for Intel Hex file
arm-none-eabi-objcopy:test2.hex: bad value
make: *** [makefile:70: test2.hex] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
Regards,
Greg
Hello Carmine and Avi,
I have finally got it working. Here is what I did:-
(1) Download and install:-
20190101-2023-gnumcueclipse-4.5.1-2018-12-R-win32.win32.x86_64.zip
URL:-
https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
(2) Then download the zip file of:-
GNU Arm Embedded Toolchain
Version 7-2018-q2-update
URL:- https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-win32.zip
(3) Unzip "gcc-arm-none-eabi-7-2018-q2-update-win32.zip" and locate the file "arm-none-eabi-objcopy.exe" inside the bin directory, then copy it over (ie replace the original file) inside the equivalent bin folder within gnumcueclipse (gcc-arm) toolchain installation.
Apparently the later versions of "arm-none-eabi-objcopy.exe" are buggy, thus replacing the newer (buggy) file with an older (working) file solves the problem.
Hope this helps someone.
Greg Woolley
Dear Carmine
I have a question about STM32F7 DISCOVERY board. I am a mechanical engineer interested in Data Acquisition and Closed-Loop Control projects. My question is how can I perform Digital to Analog Conversion using STM32F7 DISCOVERY board. The PA4 and PA5 pins of the STM32F746NG microcontroller are dedicated to high speed USB and DCMI Camera connector. These pins are not directly available to the user (in Nucleo-F746ZG the PA4 and PA5 pins are directly accessible through the morpho connectors). Do I need an extra board to perform DAC with STM32F7 DISCOVERY board? What should I do to access the PA4 / PA5 pins for DAC ?
Many Thanks for your support.
Hi Carmine,
I'm interested, as a hobbyist, in STM32 programming.
Before to buy your book, I would like to ask you if you explain how to manage LWIP + RTOS along the books chapters please?
IS there a printed version or is it only an ebook?
Thanks for reply.
First of all thanks for your book Mastering STM32. I bought it to set up a toolchain and it all went well until the STMCubeProgrammer. I cannot get it to run on my mac at all. Basically the error I can see is this
Error: Could not find or load main class com.st.app.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
Did anyone have this problem? can you help?
Hi Carmine Noviello,
Your blog is nice to have about popular STM32. I have read your book mastering STM32.
I have one doubt regarding UART tutorial.
I have this code snippet given in the book.
int main(void)
{
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART2_UART_Init();
printMessage:
printWelcomeMessage();
while (1)
{
opt = readUserInput();
processUserInput(opt);
if(opt == 3)
goto printMessage;
}
}
void printWelcomeMessage(void)
{
HAL_UART_Transmit(&huart2, (uint8_t*)WELCOME_MSG, strlen(WELCOME_MSG), HAL_MAX_DELAY);
HAL_UART_Transmit(&huart2, (uint8_t*)MAIN_MENU, strlen(MAIN_MENU), HAL_MAX_DELAY);
}
uint8_t readUserInput(void)
{
char readBuf[1];
HAL_UART_Transmit(&huart2, (uint8_t*)PROMPT, strlen(PROMPT), HAL_MAX_DELAY);
HAL_UART_Receive(&huart2, (uint8_t*)readBuf, 1, HAL_MAX_DELAY);
return atoi(readBuf);
}
uint8_t processUserInput(uint8_t opt) {
char msg[30];
if(!opt || opt > 3)
return 0;
sprintf(msg, "option=%d\r\n", opt);
HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
switch(opt) {
case 1:
HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12);
break;
case 2:
sprintf(msg, "\r\nUSER BUTTON status: %s",
HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0) == GPIO_PIN_RESET ? "PRESSED\r\n" : "RELEASED\r\n");
HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
break;
case 3:
return 2;
}
return 1;
}
In the above code, the Macros are not defined. Please take a note of this and please let me know the definitions of the given macros :
WELCOME_MSG
MAIN_MENU
PROMPT
Please coment on this.
Thanks and Regards,
Venkat
Hi carminenoviello,
I have just started reading your wonderful book. I am working on USART interrupts and came to know this example.
Using a circular buffer, we can define a new UART transmit function in the following way:
uint8_t UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t len) {
if(HAL_UART_Transmit_IT(huart, pData, len) != HAL_OK) {
if(RingBuffer_Write(&txBuf, pData, len) != RING_BUFFER_OK)
return 0;
}
return 1;
}
The function does just two things: it tries to send the buffer over the UART in interrupt mode; if
the HAL_UART_Transmit_IT() function fails (which means that the UART is already transmitting
another message), then the byte sequence is placed inside a circular buffer.
It is up to the HAL_UART_TxCpltCallback() to check for pending bytes inside the circular buffer:
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
if(RingBuffer_GetDataLength(&txBuf) > 0) {
RingBuffer_Read(&txBuf, &txData, 1);
HAL_UART_Transmit_IT(huart, &txData, 1);
}
}
The RingBuffer_Read() it is not really fast as it could be with a more performant
implementation. For some real world situations, the whole overhead of the HAL_UART_-
TxCpltCallback() routine (that is called from the ISR routine) could be too high. If this is
your case, you can consider to create a function like the following one:
void processPendingTXTransfers(UART_HandleTypeDef *huart) {
if(RingBuffer_GetDataLength(&txBuf) > 0) {
RingBuffer_Read(&txBuf, &txData, 1);
HAL_UART_Transmit_IT(huart, &txData, 1);
}
}
Then, you could call this function from the main application code or in a lower privileged
task if you are using an RTOS.
My question is, the definitions of RingBuffer_Write , RingBuffer_Read and RingBuffer_GetDataLength function is not found. The macro definition and its significance is not explained. Could you just provide that explanation.
Thanks & Regards,
Kumar
Please ... need to contact you !
Mirco Bortolotto
Is there any library for BH1750ligh sensor? I'm trying to make the light sensor work with stm32f746zg.
Hello Carmine, i trying to install Eclipse and Plug in OpenOCD.
I don't understand waht mean the 2 lines:
$ cd ~/STM32Toolchain/openocd/scrtips -> this entry to folder named scritps
$ ../bin/openocd -f board/stm32f103c8_blue_pill.cfg -> this ??? board is a folder in the scripts folder? what do the -f operator? ../bin/openocd what mean?
now in 2021 the open ocd is cahnged. Please i need help.
Hello Sir.,
I am thying enjoy the tutorial about stm32 + ethernet connectivity with this link:
"https://www.carminenoviello.com/2015/08/28/adding-ethernet-connectivity-stm32-nucleo/"
Although, I am receveing the message: "There has been a critical error on this website".
I tried to open the site with firefox mozilla, google chrome and explore.
May you help me?
Thanks in advance.
Hello Carmine!
Are you going to update your "Mastering STM32" book with the STM32CubeIDE?
Best regards,
Maciej
Hi Maciej,
Yes. I'm working on a Second Edition of the Book, but I'm late on the scheduling (there are many things need to be updated starting from the examples...).
I hope to finish in the next three months.
Great, thanks Carmine 🙂 Good luck!
Hi Carmine,
Great new!
Does this means that those who bought your book earlier will have free access to the future version?
regards.
Hi
I have both versions of your MASTERING STM32 book, the second edition I bought yesterday. These are very complete books, with content that cannot be found in other books, such as the DMA manager.
In addition to STM32, I also work with NXP ARM microcontrollers, specifically now with the iMX RTxx series (RT1024, RT1064, RT1162, RT1166, RT1176). I would like to find a book like yours on STM32, but for these NXP microcontrollers, which are also ARM and therefore must share many features, for example the MCUXpresso IDE is also based on Eclipse.
Haven't you considered writing a book about NXP's ARM i.MX RTxx? I would buy it right away if it's as good as Masterin STM32's.
Regards.
Need Little help
Hi,
I would like to get a quote for your ebook " Mastering STM32 ".
Thanks a lot.
Best regards.
Claire Poinsu
Hi, the ebook is on sale here: https://leanpub.com/mastering-stm32-2nd/
Hello Carmine, excellent book, well done!!
I'm trying to work with the CH26 project where I'm using the STM32F401RE board and the WS5500 with a SD card slot but right at the beginning where you have if(f_mount(&diskHandle, "0:", 1) != FR_OK), it doesn't return FR_OK and, therefore, no progress in execution.
Any suggestion on how to resolve?
Thank you so much.
Little experience: use SD Association's SD Card Formatter software to reformat the SD card to FAT32 file system, with size readjustment.
Apart from that, check the hardware connection 🙂
Buongiorno Carmine,
tornando sul blog dopo un pò di tempo di inattività ho notato l'uscita della seconda edizione del suo prezioso libro. Io lo acquistai circa un anno fa e mi interessa la versione aggiornata con gli strumenti di sviluppo attuali di ST. E' possibile accedere ad una qualche agevolazione o ad uno sconto per chi ha già la prima edizione del testo?
Un suo feedback sarebbe molto apprezzato. Grazie per il suo operato e per l'eventuale disponibilità.
Ciao Carmine.
Complimenti per l'ottimo lavoro.
Stò scrivendo un BootLoader via seriale per il micro STM32L433, ho preso spunto dal repository in Github: mastering-stm32/nucleo-l476RG/src/ch20/main-bootloader.c
Link: https://github.com/cnoviello/mastering-stm32/blob/master/nucleo-l476RG/src/ch20/main-bootloader.c
Volevo chiederti quale programma d'alto livello per PC è compatibile col BootLoader del Link sopra?
Grazie
Ciao Carmine,
desidero sapere se il tuo libro "Mastering STM32" esiste anche in edizione in lingua italiana.
Saluti
Hi Carmine, I am going thru your 2nd edition of your book. It is very helpful 🙂
I have some questions:
1) How did you prepare examples for the book, that it is possible to switch between examples within one project?
2) When running Device Configuration tool it creates fresh main.c file. I am confused which main.c is valid in such case - yours or newly generated?
3) I see that fresh main.c differs in structure from your examples. How did you prepare your example - using some code generation tool form CubeIDE? If yes which options you used? I would like to be able to generate code structure similar like in your examples, but I don't know how to do that.
Thank you!
Buonasera Sig. Noviello,
complimenti per la sua opera "Mastering STM32" che ho acquistato e che ritengo una pietra miliare sia per coloro che si affacciano alla programmazione di sistemi embedded, che professionisti che desiderano approfondire la conoscenza dell'ambiente STM32 ed, in special modo STM32CubeIDE .
Sono un "vecchio" tecnico elettronico di vecchia data (42 anni di lavoro in ambito elettronico), ora in pensione, che oltre progettare sistemi custom per vari clienti italiani e stranieri, a complemento di questi lavori, ho dovuto imparare, da autodidatta, anche la realizzazione di App per macOS (a partire dal Apple Macintosh 128K, utilizzando linguaggi Assembler, Pascal, FutureBasic, C, Lisp, Prograph, LabView per applicazioni Apple e successivamente per microprocessori/microcontrollori NEC, Motorola, Renesas e ST in Assembler e quindi in "C/C++".
Attualmente in pensione, mediante il tuo libro ed altri testi tecnici ( Dogan Ibrahim e Majid Pakdel), mi sto documentando sul mondo STM32 e soprattutto sull'ambiente di sviluppo multipiattaforma (attualmente su macOS) STM32CubeIDE per realizzare/aggiornare alcuni prodotti per clienti storici che utilizzavano microcontrollori ormai obsoleti o introvabili, a caro prezzo, a causa dei noti problemi sulla produzione dei semiconduttori. Comunque si tratta sempre di piccoli sistemi embedded che sviluppo su schede Nucleo ST per poi realizzare i prototipi delle schede custom definitive.
Questo é il motivo per cui Le ho inviato il messaggio precedente chiedendole se esiste anche una versione in lingua italiana, perché pur comprendendo bene la lingua inglese, al fine di evitare errate interpretazioni o comprensioni, mi sono dedicato a tradurre alcune parti (300 delle circa 880 pagine) del tuo libro, che ritengo essenziali ai miei scopi a breve termine e tralasciando per il momento altri capitolo argomenti.
Quindi rinnovo la mia domanda a cui, in caso positivo, potrà seguire una formale richiesta di acquisto di questa versione.
Cordiali saluti,
Sisto Zànier
Hi Mr. Noviello,
I've been reading your book and am pretty sure I found a bug: in
https://github.com/cnoviello/mastering-stm32-2nd/blob/main/Nucleo-F303RE/CH12/Core/Src/main-ex3.c
in line 93,
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
I am pretty sure it needs to be ADC_SCAN_ENABLE. I tried it both ways and it does not work as written (only reads the first channel), but does work if Scan is enabled.
I have greatly appreciated having the book!
Best regards,
Alan