 We will open the project It's here Then we can look around inside inside our project We will use the open the user application The main.c of this change Now Definitely here is still the HL underscore in it must be there again the system Call of config is also here Because we're using the The GPOs they are still here the GPO in it But what is new we have here the use art in it I need to compile Go to definition Specific for file Okay But we can see we have here using the The handle from the you side and we putting here the instance It's we want to use this for the side too And we in it this handle structure with the bow train and all the parameters with reset And then we calling again the you side in it as you remember from the from the MSP MSP section then if we call the in it function It is possible to create the MSP callback the qpmx using this MSP callback also Then here if we go here to the HL MSP Then we can found here. That is the HL underscore you side you art underscore MSP in it And we have here some initialization Then why we need to initialize something else from the you side or the you art because we also for example using the GPO With the you saw which are related to this pathway then we qpmx usually create the initialization for the related pins in In the MSP file and you can see first the checking Which instance call this MSP in it checking that is you saw to which is our own If it's you saw to he automatically enables the clock This is also necessary say if you remember we need first time to enable the clock And then we can configure the periphery also and then he also Configure the pins because they are related to this periphery Then this is the in it The something which is new here is the it's here this handle We use the structure in the GPOs, but it was local structure now This handles for the communication pathways and the other peripheries is as a global in this handle We store all the information which we need for the working with the with the display for it Definitely here. It's identification of the pathway that is you saw to it's not you said one It's not you said to we want you said one There are also parameters which we need to set But in this handle is is many more many more things It's usually written there how many bytes we will want to select if somebody use this periphery or not and the other other Information like if we using the DMA or what is the link between DMA about this a little bit later But this this handle is usually It's defined as a global and we can found this this handle here here The handle is necessary in case that we want to Operate with this with this pathway. We definitely need to use the handle Then we can try As usually if we want to work with the with the pathway we start with the word HL We start with the name of the pathway But I will want to work with this pathway as a you are because it's I not enable the synchronous mode than the you are It's okay, and then it's the name name of the function For the communication peripheries, we have definitely in it the in it is the standard for the all HL functions, but for the communication Usually using the words for the like the transmit or receive then here is also this this function with the same name one for the receive With the interrupt with the DMA or only the receive with the software and also here will be The transmit function with the DMA or with the interrupt and first I will use the transmit function Then what to what to put here as a parameters? I can here use the go-to definition. You can see I am in the file stm32f4xx underscore HL underscore ur.c And I can here found the all the parameters the first parameter is the pointer to our handle Which we know that it's defined as the global second parameter is the pointer on the buffer which we want to send Then is the how many bytes we want to send and Then is the timeout because the transmit is the blocking function We sending the data with the software then we also need to define the timeout after If this timeout is H we end this function with with the with the timeout timeout The first parameter put here the handle I can here copy The name it's usually starting handle generated with the creep and starting with the H and then name of the pathway in our case ur2 Then I here put the H You are to you can advise me, but we want the pointer be careful. I here need to put the end and symbol Then second second parameter is the buffer for this. I need to create the buffer Here I will define my buffer Will be 8-bit buffer unsigned Put the buffer for example with 10 variables and to recognize this this variables Initialize this buffer with the numbers Okay I initialize my buffer. It's perfect. It's called buffer then I can put it here buffer That parameter is the how many bytes I want to send It's the 10 and the last parameter is the timeout I'm not expecting here the timeout problems with the transmitting. I have here 100 milliseconds why not Then I compile my code and I can go into the debug I think it's okay Now I sending the data and now how to receive this Definitely first of all, I need to discover which comport is my use art and for this I open the device manager In the device manager, I will go here into the call ports the com or LPT And I'm searching for the esteem micro electronics stealing virtual comport Which is here and you can see in my case the number is 35 Usually the comport the stealing depends how many time you you connect the stealing comport I'm usually on the very very high number now Then I need to use the terminal. I'm using for this case the real term which allow me to use The all the comports which which the macro which the windows can handle Then here I have the display. I will want to display the hex and also the escape part and in the port I Search for the for the comport 35. It's the usb and I need to set the correct bout eight, which is 115 thousand two hundred No parity eight bit the data one stop it. This is what I send And I enable the comport and now here I run my program Sorry, I maybe forget to put here the delay because it will be so fast, but I can try I run my program Ah, you can see it's a little bit fast, but My my terminal is Surveying this speak It seems that is working we are receiving the data which we which we are sending Then this part this part is okay. I Have no problems with this Definitely here. I also want to talk a little bit about the the function the lot of the HL functions also supporting Returning the parameters. I'm not handling here the return parameter Because for the for the hands on it's not necessary But I recommend you to always when you call the function check also the parameters which the function with you back And here you can see that this a training parameter the status status type that I Can I can define this parameter in my in my project? some return variable and I can always get the information What's happened with this with this my hands on? I let them run Stop. Oh, sorry. It seems that I'm my code is to optimize for this Then he sometimes cut some part of the of the code and here in the pale I change the optimization here in the project option in C++ is the optimization And here you change it to zero this allow me to fully Debug the code because with the high optimization he usually try to delete a new spot of my code In my case, it will be possibly the return value because it's wasting for him He discovered that I'm not using this value But I want this value for the bugging this mean here or the code Be careful on the on the optimization Okay Can debug this multiple time And I can look on this variable in my watch Is the state and here to me the how okay? This is perfect. What do you care? Can I return a more? Can look here into definition of this variable You can I turn okay error this will be important that he is busy That's something the transmission is in progress and also he cannot turn the time out Then for you for the better safety of your code is good to use this callbacks Okay, now we know how to how to send the Data, but we also want to to read receive the data then I can here put the reception HL It will be received again as if you again the pooling mode this mean it's again blocking function Then if I transmitting I am blog here if I'm receiving here. I am also blog here for the for the time out time out time And I here put that I will send Then Bites and then I want to receive something for this. I will create the new buffer Buffer to Okay, I receive in buffer to I want to receive 10 bytes and my time out will be I think very long Because I need to do this all manually Then I think I put here the 100 second 1000 second I think it's okay Now and when I receive the data, I will I will stop here on my on my back point in case Or I can put here the viral one Be sure that I see only one buffer for example to block block me here I can put here the break point And we can see what what will happen Sorry, maybe it will be also good here use the a turn value also also for my For my receiving to see what will happen in case that we time out the function Now I will go to the Back here on my code and now in the terminal I Can try to Write something Okay, let's see where I am Because my my part is closed, sorry My clothes Seems that my transmitting Actually, it's not working. Sorry Then again It will be the best start the sending and transmitting here for sure. I will clear my window Don't blame me. I will mark him to show me which bytes I am sending and I am sending This is prepared. I run my code You can see here we sent the 10 bytes now I try to write him something back Ah, I get to the interrupt can see I receive the 10 10 bytes and we can look into into my watch I received here in my buffer You can see if I compare this With my with my terminal 71 0 77 Yes, 65 72 It's fits Perfect and the return value. It's okay But now I can for example The short this this delay and the 100 millisecond I will be not capable to send the Bites in the 100 millisecond after I start this this project Okay, I can run it and you can see I immediately stopped Aha here. I am a turn for me that the timeout then don't forget to get this this information from Use the the return return variables also this this These functions the pooling functions are blocking then I can only transmit or only receive in the same time It's a really limited My possibilities because then the use artist useless I cannot do the both in the same time then for this I need to use the intro or the DMA About this you will talk a little bit a little bit later in the next next hands-on