LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling stm32

Hello all!

 

i'm using Labview to control the STM32 microcontroller. the idea is to send a firmware programmed with C on IAR , then when stm32 revieves the file he execute it. what i don't understand how to send the firmware ?is it done using serial communication or labview control IAR to load the firmware into stm32's flash memory?????

 

any help would be welcome 🙂

 

Regards

0 Kudos
Message 1 of 10
(8,186 Views)

Any suggestions please?? 😞

0 Kudos
Message 2 of 10
(8,171 Views)

Hi samiti,

 

In order to assist you better, there are a few things I'd like to clarify with you first. If I understand correctly, you are using the IAR workbench by IAR systems to develop and compile firmware in C for your stm32 and that you are looking to load the firmware through a serial port. I'm not sure why you need to involve LabVIEW in the process of programming the microcontroller if you are already developing the firmware in IAR and C code - is there no provision within IAR to do this? If however, you are just trying to communicate with the stm32 through LabVIEW via the serial port, you can develop a VI for this quite easily. Once I have a better understanding of your application, I'll be able to point you in the right direction.

0 Kudos
Message 3 of 10
(8,158 Views)

Hello Joseph!

 

i want to thank you for your interest in my problem.so to clarify the situation i may explain more the situation:

i'm developping an apllication on labview which allows a user through an interface to command the stm32 (for example USART parameter like baudrate...,ADC parameters like channel,resolution ) throught a serial communication. for this reason i've developped a firmware(develloped with IAR) which is in line with my labview work.

so to make it short the user brings his stm board connect it to PC and run the labview appliction and gets result.

 

so this is my problem : at the begening the usart config of labview can be different from stm one that's why i must use another way to send my firmware to be executed by stm32 then when stm execute it the USART will be configurated as the same configuration as laview and the serial communication can begin(the user change ADC parameters for example)

 

==> how can i send my firmware to stm32 without using serial communication?(i should note that the user is not supposed to run IAR to load the firmware into stm32 flash memory ,all what the user must do is to send a configuration via labview in order to use the application developped with labview)

 

hope this is clearer, please do not hesitate to contact me for further explanations.

thank you too much for answering me.

 

best regards

Sami.

0 Kudos
Message 4 of 10
(8,145 Views)

You don't have a whole lot of options. You could use a bootloader with your stm32 that could quickly check to see if there's a source of new code. For example, the code could be on an EEPROM that it can communicate with using SPI. It could also download it over the serial port, but you said you don't want it to get firmware over the serial port. Other than that you'd need to see if the IDE you use to program the stm32 has a command line interface that you can call from LabVIEW using System Exec.

0 Kudos
Message 5 of 10
(8,135 Views)

Hello all,

 

thank you for your responce, the point is that i'm new to labview and stm programming so excuse my ignorance for certain things.

you proposed these solutions:

-call my IDE command line interfacefrom labview: i think that if user do not have the same IDE installed on his computer this will not work

 

-use the bootloader: after researches i found this informations(page 14) on stm32 document which i attached below:

"" Once System memory boot mode is entered and the microcontroller has been configured  the bootloader code begins to scan the USART1_RX line pin, waiting to receive the 0x7F data frame: one start bit, 0x7F data bits, even parity bit and one stop bit.

The duration of this data frame is measured using the Systick timer. The count value of the timer is then used to calculate the corresponding baud rate factor with respect to the current system clock.

Next, the code initializes the serial interface accordingly. Using this calculated baud rate, an acknowledge byte (0x79) is returned to the host, which signals that the STM32F10xxx is ready to receive user commands.""

 

i think this is my problem's solution, what i understand from this is that with labview i send (fro example with 9600 baudrate) a byte 0x7F(i must send it in hexadecimal 0x7F (why the 0x can i only send 7F?) or in ASCII code ( Del)?) so the bootloader gets this frame and calculate the baudrate with which i sent data  with labview so he 'll find 9600 then he use 9600 to send bach an acknowlgment so when i receive this acknowlgement with VISA read i tell the user that he can start sending command.

please correct me if i'm wrong. 

0 Kudos
Message 6 of 10
(8,125 Views)

hello all!

 

thank you for your responce 🙂 you've proposed many solution:

-   use my  IDE command line interface that you can call from LabVIEW using System Exec --> i think this not possible in case that user do not have my IDE installed on his computer

-use stm32's bootloader : i've done researches and found these information(i've attached the source doc below):

 

"Once System memory boot mode is entered and the microcontroller has been configured , the bootloader code begins to scan the USART1_RX line pin, waiting toreceive the 0x7F data frame: one start bit, 0x7F data bits, even parity bit and one stop bit.

The duration of this data frame is measured using the Systick timer. The count value of thetimer is then used to calculate the corresponding baud rate factor with respect to the currentsystem clock.Next, the code initializes the serial interface accordingly. Using this calculated baud rate, an

acknowledge byte (0x79) is returned to the host, which signals that the STM32F10xxx is ready to receive user commands"

 

===>I think this is the solution: so what i understand from this is that bootloader waits untill user sends (using serial communication for example with 9600 baudrate)via labview  a frame with 0x7F  byte ( must i send it in hexadecimal 0x7F and why 0x why not send onlt 7F(what is the use of 0x?) or send the ASCII code corresponding to 0x7F (Del)??) then when bootloader recieves this frame he calculates the baudrate with which i send my frame (he will obviously find 9600) and send bach an acknowldgment with the baudrate calculated so then labview program ,when he receive the acknowldgment ,tells the user that he can now send his command.

so what do you think of this ?is this the wright solution?

 

thank you too much!

 

PS:please correct me if i'm wrong and execuse my ignorance of some points because i'm new in labview and stm32 programming.

 

0 Kudos
Message 7 of 10
(8,123 Views)

Excuse me i didn't realise i sent my message twice! i thought the first hasn't benn sent correctly!! 

 

thank you for considering only the second message !!!!

 

sami

0 Kudos
Message 8 of 10
(8,120 Views)

The booloader is a special piece of code that you write and program into the stm32. Its only function is to see if there's new firmware available, download it, write it to program memory, and then boot the microP. Bootloaders can work in a variety of ways depending on the capabilities of the microP. In this case it looks to see if there's communication on the serial port. This is fairly common. So, if you want to write a LabVIEW program to provide the new firmware, you basically need to have to LabVIEW program send the appropriate signal (in this case its the byte 7F) and then when it receives the ACK it can send the firmware code.

 

By the way, 0x indicates it's hex. Do you know what a hex number is?

 

It sounds to me like you need to get some training with microprocessors. Bootloaders are not for those who are beginner programmers with microprocessors.

Message 9 of 10
(8,112 Views)

Hello ,

 

As i said i'm new in programming with labview/stm32 but don't worry i'm a fast learner 🙂

well  thank you for clarifing things i really apreciate your help!

 

 

PS: if you have any usefull links to stm32 programming please do not hesitate to communicate them 😉

0 Kudos
Message 10 of 10
(8,103 Views)