Welcome to the FAA Production Studios and the FAA Safety Team's National Resource Center in Sun and Fun Complex located in Lakeland, Florida. Our next presenter is retired from the Cirrus Design Program where he was an Air Safety Investigator and was Director of the Air Safety Training for the past 16 years. He is a member of the International Society of Air Safety Investigators and teaches at the NTSB Academy at the Transportation Safety Institute located in Oklahoma City. Also he makes presentations at numerous fire colleges, fire departments around the country talking about what to do after the accident. Mike is a Navy Veteran, served as an aircraft electrician and air crew member on the USS Saratoga involved in helicopter support squadron, HC-6, he earned his Bachelor of Science Degree in Management from Emory Riddle and worked for the Daytona Beach Fire Department as an arson investigator while finishing his degree at Emory Riddle. He is a commercial pilot with multi-engine and instrument ratings and is a certified airframe and power plant mechanic. Mike has been a member of the EAA since 1974 and has co-founded the EAA Chapter 534 in Leesburg, Florida. He has been involved in numerous aircraft restoration projects including the Collins Foundation B-24, the All-American and B-17-909 bombers from Tom Riley's bomber town facility in Kissimmee, Florida. Mike has owned four aircraft, a 48 Stinson, a Satabria, a Long Easy that he built and raced in Sun 60 and a 1948 Navion. He is currently working on an F-1 rocket. His topic today is what happens when the phone rings? Let's welcome Mike Bush. Morning, Walt. Thank you very much. I know it's kind of an unusual title. First of all, I'd like to welcome everyone to Sun and Fun and everyone here in the studio for their support. I was an accident investigator for some time and as such, we always have to carry the phone with us and people always knew what I did but they didn't know what happened after the phone rang and I left, got out of sight. And so that question came up so often that I thought I would put a little presentation together about sort of the behind scenes things of what we do because as you can imagine, most accident sites are restrictive and you don't let everybody in and we do have to do our work. So we are always answering questions about that but the question for most in our minds is why do we investigate accidents? Well, of course, we want to learn what happened and so that we can learn from those facts and pass it along so in our hopes that something like that won't happen again. And the other question is, of course, how do you do it? Well, it's a science in a way and as many accidents as I've had to be with and investigate, I can say there's a sort of sameness about all of them but at the same time, they're all a little different, different airplanes, different locations and different situations. So there's a lot of variables you have to look at. If you work for a manufacturer, a certified manufacturer, the NTSB, the National Transportation Association, expects you to have a qualified accident investigator on call. It's part of the job that a manufacturer has to deal with. He has to provide the support to the NTSB and a lot of folks don't know that the National Transportation Safety Board has jurisdiction over all civil accidents in this country. They're the boss. They're the ones in charge. But they can't possibly know everything about every airplane out there and so they do expect us to provide some expertise on our particular airplane. And so as such, if they need us and only if we're invited to the investigation, they will call us and say, well look, we need your help, can you participate? So we wear the phone and when the phone rings, we got to go. And I think our record in our department was 12 minutes out the door. I think my own personal record was 20 minutes. You've got to travel typically to anywhere, any time because you never know where these things happen. They are accidents after all. And you have to be ready to provide professional assistance to these folks. The recurring questions that we also have is why did it occur and what can we do to keep this kind of accident from happening again? The board investigates the accident. They're in charge of it. They are the boss. And so when we get called, we go out there and we do what they ask us to do. Now typically in our case, when I was at Cirrus, we were in charge of the airframe portion of the investigation under the guidance of the NTSB. And of course, the other person that can be there is the engine manufacturer. In the case of a commercial airliner, you might have a representative from ALPA there. But other than that and the FAA, those are the people that are the primary investigators on site. The NTSB will write the report. You can pick these reports up online. If you've never done that, you should do that ntsb.gov under the aviation section. You can look up accidents as far back as 1947 now, I think. They do a good job with that. And so they write the report and they're also responsible for the site and the security and the safety on the site. We always want to make sure that, well, we've had one tragedy. We don't want to have another one occur with people stomping around in the wreckage and so forth. It doesn't help our investigation much either when evidence is destroyed. It's evidence and all the things we look at is very perishable. Things roll downhill and animals run away with stuff or it's raining and so forth. A lot of times the wind blows away, critical papers or whatever. So we have to get there quickly and try to capture all this evidence and all this information so that we can try to make sense out of what it is we're looking at. One of the problems we have is that sometimes an airplane doesn't even look like an airplane when we get there. Now the main job when it's all said and done is that there's a five-member board on the National Transportation Safety Board that ultimately will take the report, review it and then determine the probable cause. They're the only people in this country legally that can do that. That probable cause is determined by these five board members. We say probable cause because typically we can't get every little scrap of information that we need. We can see trends and we can put all the pieces together but sometimes stuff is still missing and so we can't say absolute cause. We say probable cause and by the way even after the report is written and probable cause has been determined they will open up a case again if they get new information and I've seen probable causes actually change from case to case because of that. And when it's all said and done they sum up what we learned from this accident and if there's something new they will try to make recommendations to the people they think are involved. You need to change this, improve that in an effort to prevent these accidents from happening again. The FAA of course also participates in these accidents and as a matter of fact they are involved with every single accident that the NTSB does. FAA is a regulatory agency. They make up the rules and enforce them so they're the guys that can ground you or take away your medical or what not but more importantly and more positively they have all the paperwork that we need in the event we have an accident we have to do some investigations. We want to know who the aircraft is registered to and who owned it and who the pilot was and what were his qualifications and so forth. So the FAA has all that data and so as an automatic policy they are involved in every single accident as party as we call it to the investigation. So FAA is administrative and enforcement primarily and they will be participating in all the accidents. It is a congressional mandate that the manufacturers may be participants in this but we do have to be invited. And so typically that phone has to ring before we can go. Now the phone can ring and it can have anybody on the other end of the phone calling us. I mean I've had police officers call me I've had you know just civilians call me a fireman and they say hey you know there's an airplane down here we think it might be one of yours and so the phone can ring anytime and in fact in my case it has rung I think at every hour that I can imagine almost any day and any time. I can't tell you how many dinners I've had to get up from or movies to get away from so I could launch to go on an accident but it all starts with the telephone. So the manufacturer like Sirus in this case had me available and I was the one that launched for a long time I was the only guy and so for 724 I had the phone and that was it. Later on we as we grew we had some more people in the department we got trained up and so we didn't all have to carry the phone all the time. The engine manufacturer has a similar representative on hand and typically our experience is gained from a number of sources which I'll deal with in a second here but we are qualified to participate in these accidents by virtue of the fact that we know the airplane really well. Alpa is also the third person outside of the federal representatives that could be there and it doesn't guarantee that we have party status on each on each accident we have the congressional mandate of being allowed to if they need us there. So how do the NTSB form an effective team when when they get the call and this aircraft goes down somewhere in middle of nowhere how do you get all these people together on short notice and be able to run an effective team and the answer is pretty simple really it's professionalism everybody knows what they are supposed to do how they're supposed to do it and we all work very very closely together as a team the NTSB are past masters of putting teams together since they have jurisdiction you know a lot of a lot of the first responders and fire departments and law enforcement agencies aren't always sure who's in charge they always think their chief is in charge and so on and well in fact it's the NTSB that is in charge and so NTSB has to you know kind of take over and run the thing but they do so very well it's almost seamless and they're very very professional about how they do this and we don't have a lot of time on site and so all this has to come together very quickly we all are dedicated to this industry and looking for those answers that are pretty elusive we all have a lot of mutual respect for each other and as you might imagine since there aren't very many of us I would guess there's probably only 200 investigators in the whole world we pretty well know each other from time to time we can we can count on our experience together to help us get by too and we help each other the engine guy will help the airframe guy and so on and so on and over a period of time you develop a reputation which is very important and so that respect is there and we all respect each other really work hard I like to say it's all about relationships now this is not a good old boy system it is all based on respect and and mutual help and so forth the skill sets that are required of the accident investigator are many it's a craft which has to be developed we don't we don't come into this world with these skills necessarily we have to learn what it is we're doing and what it is we're looking for what's important so it's a craft and so there's a lot of mentoring and training I remember one time I was at a at a sort of a fender bender and they invited me to come down as sort of part of my experience on the job training and and the investigator in charge from the NTSB was about to get on an airplane go back to Chicago at the time and he said I asked him a couple questions and he said no wait a minute he looked at his watch and he pulled out his airline schedule and we both sat down on a log and he spent the next three hours mentoring me he could have gone home earlier but he sat right down there and walk me through how things are done that's the kind of professionalism that you see and there's a lot of teaching going on kind of behind the scenes so mentoring and training is extremely important of course you can't beat on the job experience because every accident is a little different and you learn just lots of stuff from each time there are schools and there are workshops which we all participate in when we go to these things typically you're going to see experienced investigators and we one more time get to talk outside of the accident environment about accidents and that can be very productive as well if you're going to be an accident investigator a lot of people don't understand that you really have to be a good communicator both written and technical skills oral verbal you've got to be able to talk to people at any level to ask the right questions to listen to what it is that they're saying so many people you know tend to think they already know what happened before they ever get to the site and that's that's a bad thing you want to be very open-minded you want to not be predisposed to any particular situation people always ask me when I was going out the door what happened I said I don't know but that's what I'm going to find out you know we can't possibly know till we get there so we have to be able to communicate with each other at the site and then when we get back we have to be able to talk to other people about it a common sense believe it or not is huge you know why is this airplane upside down why is it there instead of over there now there's an answer for it the airplane is trying to talk to you really just like when you're flying one it's got all these noises and senses and stuff you can hear the airplane if you listen okay well there's no different on-site and so common sense is important you have to ask those questions integrity you know you can't go down there and try to try to be all pompous and show off and tell everybody you know something because that doesn't work I mean all pretenses go away and in fact when we get on-site pretty much all the logos and badges come off we're a team we work together there's no job too small or too large for us to do if the engine guy needs help digging his engine out of the dirt well we all get you know time on the shovel and so forth so we all help each other a lot it is a team and you've got to be dedicated to this this is this is hard dirty work it's not fun you're out there for you know a couple days three days at a time sometimes in the middle of nowhere terrible conditions I know one of my co-workers actually spent some time living in a in a container on site because that's the only hotel that was around so you've got to be pretty rugged and ready to just kind of make do so therefore you have to be flexible you have to think about alternative paths and well gee I would rather do this but I'm going to do that because that's what we need to do today and so those are the things that you look at also you have to have pretty good imagination so our pilot skills and my backgrounds in the industry as mechanics or as pilots and so forth you get a sense for what the pilot was going through in this accident the victim maybe you have to be able to visualize what was going on why did this thing come down here you know why was he going through the trees like this so if you can visualize what happened it makes it easier to understand what happened and therefore why these are all things that we make as part of the puzzle and we we share our views with each other and I'm not saying we all agree on the contrary we do sometimes have diverse views of what happened but we we walk through it we I remember one particular accident we had there was a particularly difficult one to solve and we met every day for a month every day at the end of the day we'd sit at this table and we'd say well what happened and one by one we go around the tables I don't know I don't know we didn't figure it out and it was pretty depressing but eventually we did so in the end when you're out there working and it's you know a lot of pressure a lot of and you're tired and everything else you know that's when you're not at your best necessarily but really it's when you have to be at your best and especially with your co-workers out there and so it really requires exceptional people skills I'm told we all have challenges we have to face at the accident site as I said there's there's some kind of confusion sometimes among the first responders of who's really in charge because it's kind of a changing scene I mean the firemen will typically respond first if there's a fire they're out there and then the law enforcement people show up and then the medical examiner comes well who's really in charge and sometimes the people that are in charge are on their way they're not there yet the NTSB has to travel and there are only 10 regional offices in the country and so it takes time to get out to some of these places and in the meantime we all have to get along and you know follow the leaders so to speak so there's this there's this continual chain of command that's kind of moving and a lot of the people that that support these accidents don't understand that well wait a minute I thought he was in charge now now this guy showed up now now you're in charge what's going on and so you know we have to be kind and gentle about this but definitely the NTSB is in charge and in many of my seminars I would I would tell the firemen this and they weren't sure well my chief is my boss well yes he is but in the art of investigation it's the NTSB and wreckage can be located a number of places you know underwater up on top of a hill and somebody's house you know they're everywhere and you just have to deal with it and it's it's a it's a calculated risk there a lot of the pieces may be missing it's not a given that all of the airplane is going to be where the hole is you know it it we may have had pieces coming off of it for miles and and so we have to go out there and find every one of these pieces as well because it's all part of the puzzle puzzle sometimes we do find pieces but they're in a condition that renders them worthless to us because we can't recognize what they are they're all burned up or bend up there's no part number on it but we know that it's probably from the airplane and I remember one investigation we had a bunch of people out there walking around helping us pick up pieces it was the airplane actually crashed in a prison so we had some captive labor there and it was snowing and we were looking for a very small piece of the aileron system and and so we thought that these prisoners would be willing to help us and sure enough they all volunteered because they wanted something new to do and we gave each of them a little bag and we marched them out in waves and we covered the whole the whole prison ground which was rather enormous and at the at the end of the search we we removed their bags from them and one by one we emptied them on a table and we started finding things that weren't necessarily airplane parts we found a windshield wiper and some other stuff pieces of lawnmowers and whatever you can imagine and we took one of these pieces back to our engineers because as a joke because we knew as part of a lawnmower but we weren't sure if he did so we put it on his desk and he kept it on his desk for about a week before he figured out no that's not an airplane part so so you have to have humor in this job and tell you it's called gallows humor and sometimes you have to make fun of it but it's the only way you can keep your sanity because some of these things when you get out there pretty horrible yes you can imagine we have to deal with a lot of that and it is the pure horror and I've seen people get out there and just be completely overloaded their senses are just totally overloaded I mean you know you're going to an airplane accident and okay you're walking toward it and yeah that looks like maybe the tail and closer you get you may find that you don't recognize anything and or if you do you understand that well that's an altimeter but but why is it there and and gosh there's an HSI and what is it doing there and oh here's the guy's hat you know it's all these conflicting senses that you have to deal with but it's all part of the puzzle and it's it's huge politics there's always somebody somewhere that wants to be part of the accident investigation that's really not allowed to be there and the NTSB has very specific guidelines as to who can be on site they don't allow attorneys on site or corporate officers for example to be there as you can imagine they have an ulterior motive sometimes or want to steer the investigation their way or the other you can't do that we have to be very objective in our findings and what we're doing there and politics are always banging on the door and we always rely on the NTSB investigator in charge to deal with the politicians of course sometimes the family you know the people that survive this thing will want to be there and want to see you know where their husband or loved one died and so we make arrangements for them to come on site to but we have to deal with it and the media the media is always looking for six o'clock headlines and it's always difficult to deal with them because they're just in the entertainment business really and I guess I guess you can tell I'm not really a fan of the media I think the news is important but I think it needs to be objective and not sensational and the media is always trying to spy on us we've found them with directional microphones that can go about a thousand yards and their cameras are taking pictures of our notes and so on they're either dropping on our conversations and they broadcast them at the six o'clock news that's actually happened to me so we're not real fond of the media being out of control like that and so typically when they approach us and want to interview us we're just the the team we always refer them to the NTSB investigator in charge he is the spokesperson for the investigation that helps a lot and a lot of people talk about the inconvenience to your in your nice warm bed in Duluth Minnesota in the middle of winter it's only 20 below out there and you got to get up and go somewhere you're not sure where and to an accident and so a lot of people don't like being inconvenienced being on call all this time so that's kind of difficult strong sense of humor helps we called it the gallows humor I'm sure you've watched Law and Order some of those are TV shows where Lenny Brisco the detective always has a smart alec remark to make that's that's not uncommon and we're not a bunch of frivolous folks and we're not that jolly either but we do have to get through the horror of it all I call it the ashtray phase of the investigation you've got to be objective and you've simply got to be able to get through that terrible terrible terrible loss of people and once you do that you can do a good job so sometimes we we tend to kid each other and it sounds pretty sick to outsiders I would guess but it keeps us going anyway and certainly has with me at same time you have to have a lot of compassion gee this could have been me poor guy what's this family going to do you know and those questions come at you the whole time you're there forever and I don't think I've ever forgotten a single accident I've been to I can tell you exactly what I saw for years and I probably never get rid of it so that compassion is always there there are four phases of an accident as you might imagine there's the rescue phase that's when the firemen are there we always do everything we can to to help the victims and if there's no hope for them and there's always the possibilities of fire or hazardous things going on some of these new aircraft have systems on board like the parachutes these ballistic parachutes and and inflatable restraints they have some ordinance in them and if those weren't used in the course of the accident then they're live ordinance we have to deal with that too the investigation phase comes next and hopefully the fire department has sealed off the sites that we don't have a lot of folks run around out there a lot of people like to take souvenirs from from accidents I don't know why it seems kind of grizzly to me but we need those things to help us determine what happened and of course at the end of this sometimes we call it the recovery phase we might recover the the wreckage right from the site but more often than not it's in an inconvenient spot and so we have to move it someplace where we can examine it in more detail in more privacy and so every time you move the wreckage of course you're losing evidence stuff falls off the truck or you forgot something at the site or whatever and so it is perishable and we really hate to move things we like to keep it in situ as long as we can but the recovery phase is important because it is an inconvenience for the farmers field where this thing took place or somebody's house we need to get it out of there and put it in a place where that we can we can actually do a professional job taking a look at every little piece we actually lay it out and try to account for all the parts of the airplane so the recovery phase is very important and sometimes the recovery phase happens before the investigation starts if we can't get there for a day or so and somebody's got to get it off off the highway well you know we're not going to see it the way it was when it actually happened so that's difficult and finally the legal phase when it's all said and done there's attorneys out there and they want to blame somebody and we have to deal with that as well and as investigators typically we do get deposed and that's to make our comments known to the legal world. So here's a rescue phase this is not uncommon in this particular case it was a fatal and all you can do is try to put out the fires and and just deal with it. I show these lockers this row of lockers people say well what's it like to do an investigation I said well it's not looking at lockers but the symbology is here if you can think of each of those locker doors as a clue or a part of the investigation that you have to do a possibility engine failure fuel failure whatever lack of too much air in the tanks as we say look at these lockers and consider each of those a clue and when we get there all those locker doors are open and when the investigation's over we we've needed to have all those doors closed there might be two or three left open those are the that's where we focus our investigation so there's a lot a lot of things we have to ask questions about and get the answers to so what does happen when the phone rings well the call can come from anyone anytime and if it's an 800 number you know you hang up but typically NTSB people call us and let us know that we need to participate in this thing and they'll ask us to send somebody there the very first thing we ask is can we have party status and that's granted right then there or not and when we get to the site we do have to fill out a party investigation form that puts us legally into the investigation for the NTSB as as the representative for our manufacturer and that's that's part of the protocol what you have to do but the first thing you do in the phone rings is ask for permission to go they don't want you traveling halfway across the country if they don't need you and we don't want to spend the money either but we're anxious to be there that's for sure so the investigator on call has to be prepared to go anywhere anytime so you have to have your medical stuff in order if you're going to go overseas you've got to have your passport ready and all your tools and stuff that you may need on site ready to go we call that a go bag and of course the very first thing you do is verify that it's a legitimate accident we've had people call up and they think they're being cute but they will report an accident which is really a false alarm and it really is pretty terrible thing to go through because we get pretty wound up when there's an accident as you can imagine it's a lot to do and and the adrenaline's pumping and we've got a fine transportation and we don't need a false alarm at that point so we ask all the appropriate W questions where when who all that stuff and we request the status and then if we can we have time we'll brief our internal people in the in the company now we always had carte blanche to launch any time anywhere if we felt it was something we had to go to we didn't ask questions and they didn't either we just left but if we have time we try to brief them on what we think happened you know at least where it is what what the early reports are and then we get on out of there and at service we were lucky we had internal airplanes that could fly us to some of these things and we also made a policy of the investigator not being the pilot either coming or going because we're always a little bit stressed both ways so we always had somebody from the company fly us there the internal team works their contacts as well I mean we're always looking at the newscasts and trying to get footage and so forth because sometimes we can learn something just from the film and a lot of our news folks are are really cooperative and they help us with footage they're pretty good about that so we get to the site as soon as we can and here's Brad Miller one of our he's running the department now that I'm retired we call this the well-dressed air safety investigator he's got this Brad was a ranger in the army he's he's not opposed to carrying 80 pounds on his back plus your clothes that you're going to need and this is what you look like when you go roller bags are really important we carry a lot of stuff you never know where you're going you don't know if it's going to be an accident an incident offender bender until sometimes you get there once you get on an airliner and you're heading out there you're out of touch with the real world the phone calls keep coming in at the company and so those people will gather all that information in a minute we touch down they'll give us a brief on what they've learned and of course when you get to the site the ntsb will brief you this case was a windstorm there was no federal oversight or required meant to be there but this field in Ohio got hit with a big storm and there were a number of airplanes that had been flipped over and moved around on the airfield this particular Cirrus was in its protective hangar and the windstorm picked up the Cirrus and the hangar and deposited it some hundred yards or so down the way and then the main beam and the hangar came down and pretty much cut the airplane in half and the owner called me and said Mike Mike they're trying to move my airplane talk to them and so I got hold of the airport manager I said you know you don't want to be doing that why we got to get it out of there I said well you know there's a ballistic recovery system in there and only takes a quarter of an inch or movement on the activation handle for that rocket to go off didn't know that so I said well don't move it and there is a picture here I don't know if you can see if this arrow is off a little bit but you can see that one of our investigators I'll try to get it right there that's Mark Manning's foot and we sent him down there and he is in the process of of actually disarming the rocket and of course it's in a puddle of gasoline there because it ruptured the tanks and so on airplane was total but at least we got some safety on site and nobody was hurt but people don't know about these things and so they tend to make rash decisions in a hurry you think it's the right thing to do we we often launched on things that weren't covered by the NTSB at the site you got to secure the site preserve evidence and beware of the hazards which may be present and there are a lot of them I mean you got you know critters and animals and you know all kinds of things that you don't think about it might be there this was a site that I responded to one of my very first ones the NTSB called me and asked me to come up to New Jersey and I said are you aware that there's a ballistic parachute on that airplane he said no I didn't know that and I said well I think you need to understand we've got perhaps a hazard there what do you want me to do I said well he's keep everybody out of there till I can get there now this doesn't always happen but as you can see in this case there's some pink ribbon around this thing and it doesn't look much like an airplane I know but if you look here those are my footprints that you know I got there about eight hours later nobody had disturbed the site whatsoever I was the first guy on site and of course I found the rocket which was over by the tree there and we were in business in about five minutes the rocket was inert and we were able to get on with the investigation but no further ado but sometimes there's just nothing you get out there it's just as big vast wasteland and you and the and the airplane and the victims there you are or sometimes it can be in a fairly dense environment this was this was in Florida actually so on the first day on site what happens well the parties all get together with the NTSB and he the he or she the investigator in charge will brief everybody on what we know we'll also review all the rules what kind of restrictions that there may be that may be applying to this or the expectations and you know what do we expect to view right and of course we sign the ever present party form and the I I say we'll explain how the investigation will proceed and also we're given assignments know you'll do this you'll do that in addition to all of our normal things first thing I would do normally is disarm the the rocket and the airbag system and then deal with the rest of the of the airframe time is short people think that you're out there forever and in fact over a period of time I average it up we sometimes get no more than about four hours on site there's all kinds of pressures to get this thing done in a hurry which is our enemy time is our enemy there and so we don't always get the amount of time that we need so we work quickly and very very efficiently I think so we have a plan we work the plan and we try to determine what the priorities are we condition like I said I determine the condition of the service airframe parachute system and the restraints inflatable restraints we walk the site just to get an idea of what we're dealing with we note the energy path and direction and right then and there we take what we call contingency photos because you don't know if your camera is going to run out of batteries or if the cold is going to get to your to your many cameras that you carry and render them useless for a while there we all bought the same kinds of cameras so we could swap batteries back and forth and chargers and so on and we're still doing that to some extent but we take a lot of early pictures we call them contingency photos just so we've got something in case everything falls apart technology wise and if we have time and the space will lay out what we think is the wreckage in the shape that the airplane should be the tail at the back and so on and we do an inventory right then and there to try to figure out if we've got all the parts and if we don't we go look for them if we do then we review it very carefully take detailed notes and this is a slide I show in some of the presentations we do have to disarm this stuff I mean it is a hazard and and it's unexpended ordinance and so what sign says as I'm a bomb technician if you see me running try to keep up that's almost a joke but at the same time pretty serious about what we do and a lot of firemen you know if I'm in a living firehouse together they're a very close knit team as opposed to police officers which are fairly independent people each of their own squad car and so on firemen tend to spend a lot of time in the dorm if you will and they do like to play pranks on each other and so we've got to kind of watch them carefully always show them this slide to get them aware of the fact that we really don't joke around when we're dealing with ordinance we try to document everything before it's moved if possible there's always a big hurry to move things so we asked the firemen to make sketches and take videos if they can before we get there and you know they're getting pretty good about that a lot of the trucks have video cameras mounted right in them and we can see what they're what all they're doing and we also try to line up these shots with a prominent landmark because just looking at a picture with no reference points can be very difficult to figure out later and take multiple shots we average about a thousand pictures a piece on a site I know it's a lot to look at but you're always missing that one shot you wish you'd taken you know a lot of these airplanes don't have voice recorders or the digital digital black boxes and we're getting better about the black box part but we're still not there we're not at the airline thousand channel boxes anymore we're not there yet so we have to do it the old fashioned way and we have to for example look at these marks on a tree to see if we can figure out what the angle of of impact was from either a propeller or a wheel or perhaps a wing or something like that and we also look at the registration number who's it registered to we'll figure that out very quickly look at the data plate and try to figure out who owns it this is an interesting story that Jeff Gazetti who's one of the higher ups in MTSB now but when I first met him he was an investigator with Cessna and he said well you know you need to take a model with you of the airplane if you can because a lot of times when you're talking to a witness they don't know all the terminology for aircraft and all the things that we do a loop and a roll and a whiffer deal and a you know a lump shavak is all the same thing to them and so if you put a model in their hands they can sort of trace the path of the airplane show you what it was doing and you can make your own conclusions from that and that works out pretty well so we went on and bought these airplanes now they didn't look like cirruses but they were durable metal ones low wing with the engine in front sort of thing Jeff had cautioned us that he had a rather expensive model that he took to this particular accident when he was with Cessna and he gave the model to one of the to one of the witnesses and he said would you trace the path of the aircraft for us sir and the guy said well sure here you go it went up and then it crashed he said boy that model cost me a lot of money so we learned early on to buy lots of cheap ones that were fairly durable at the end of the day first day you wrap up the meeting you get everybody together well what did we learn and we try to review all the things that we know and what's missing and we drop a battle plan for the next day and typically we'll all go out and have some kind of dinner together if we try to I know it's tough to do but we may not get together until nine ten o'clock that night but we'll try to have a little bit of time to kind of put the accident aside just to relax just a little bit and get ready for the next day you're working a lot of long hours out there and it's pretty tough on everybody and this whole process can take several days we've we've been on site for you know a week at a time sometimes I know I said four hours earlier but that's an average the myths there are lots of them out there the plane always blows up and burns with my experience with serious less than a third of the serious accidents had fire involved you know it's made out of fiberglass it's going to burn no it doesn't always the plane doesn't blow up either the engine always sputters and quits before impact well there's some truth to that it doesn't mean that there's a bad engine it means that the pilot's probably pulling the mixture back so you know to minimize problems but the witnesses always always say that it sputters and quits before impact read the next accident report you get and you'll hear that the pilot in command was the best pilot ever and we know and we know that a huge percentage of accidents are human factors oriented not necessarily bad pilot but he had a bad day perhaps and so that's that's that's a tough one because you deal with the family and I think he was you know the ace of the base and he didn't even do a pre-flight so so you never know anyway those myths are important and we also laugh at this one one person always solves the mystery you get the guy with the golden bb I know what it is I don't think it's ever happened to us we always do it as a team and we work together and we kind of evolve to the answer is how it works of course black boxes aren't black a lot of people don't know that this is these are flight data recorders from airliners and the recovery phase is like I say sometimes precedes the investigation or sometimes is after we've been there this particular serious was went into a river and of course we had to pull it out after disarming all the goodies and the airplane was underwater at the time so it was bobbing up and down and we only have a quarter of an inch of cable to play with on these on these rockets cockpit and fuselage was full of gasoline and there I was in my rowboat all by myself out there so it was interesting but it was important to know that when I showed up they all knew all the first responders had heard that there was ballistic parachute on board and they said we're sure glad you're here and they're all standing back and there's your boat go do so we did so the recovery phase means that the airplane is going to be moved probably again and that you've got the possibility of losing evidence we get into a lot of component testing sometimes it's pretty rude and crude we'll hook fuel pump up to a battery to see if it pumps and we'll check things certain things that we can on site check the engine for thumb pressure and so forth we try to get a general fuel for what's going on and at the end of the day again we're going to review the facts summary from each of the investigators that are there sometimes you'll spend a couple days just building a road to get to the thing this is when we did in california it was in a thousand foot valley and we actually had to build a road to get the tractors and trucks in there to be able to get the wreckage out so then you transport it to a storage facility typically where it's stored and we also do a fair amount of layout investigation right then and there but it's stored for some period of time until insurance people can look at it and of course the legal folks will have a look at it when it's all over this is a typical wreckage layout at one of these facilities this one's in arizona you can see that the white part of part of it there is the cowling it's heading to the right and the rest of it is the spar and the rest of the airplane it was all there believe it or not the rest of it was on the trailer and we found every piece of it so when we get home what do we do then well the accident investigation continues we have to brief senior management on what we found and of course the ntsb investigation is ongoing and then we share all the data with all the other parties we exchange pictures and preliminary reports we all talk a lot and then we'll send our preliminary report to the investigator in charge and at that point we write our own report internally they're not different they're just ours is pretty lengthy our preliminary report to the ntsb fairly short and we sometimes have to do other trips we average about three trips per accident they might be to forensic investigations engine tear down investigations that sort of thing it's it's what we do we look at everything simply everything engine tear downs autopilots fuel systems electrical components the structure landing gear avionics it's all there and it's all important because it could be part of the problem this is a blue engine box some of you may recognize this is what the continental company uses to transport their engines in and typically if we're going to look at the engine in detail the box comes to a site the fAA takes custody of the engine puts the engine in the box and seals it and is custodian of that evidence they'll send it down to the continental company in alabama mobile is where their home office is and that will be placed in quarantine until we can schedule a time for that to be to be examined and all the parties from the investigation are invited to come to that we always go and so we're there with the investigator in charge and of course i'll be there and then the folks from continental will be there they have some expert mechanics who are really good at taking these things apart and we will do it step by step by step right down to the nuts and bolts here's what it might look like this one was involved in a fire and it's all sealed of course and we take it right down to the various components here we are testing some spark plugs for example this was a mcu or electrical components box that arrow is off again but just below the body of the arrow you'll see a difference in color there that's that's a piece of the of the pc of the card that actually burned and has a discontinuity there so the initial report schedule that the ntsv will put out you can find that on www.faa.gov the faa usually reports it first and that's on the web for about 10 days it's usually gone in 10 days it'll be on there in one to three days and sometimes it's the first notification that we'll have that something happen sometimes you get a little fender bender you know somebody hit a taxi light or whatever but it could also be something more then the ntsb on www.ntsb.gov on the aviation portion of it within 10 days they will put in a preliminary report now prelims are typically wrong i mean they might get the place and the time sort of correct and you've probably read them you know on such and such a date such and thus happen but it is a preliminary report it's just a report that they're working on and the details are pretty sketchy they're pretty short maybe two or three paragraphs and so you're not going to get a lot from that other than the fact that you know Osiris went down in allentown or someplace and then of course the final report that the ntsb does can be on the public docket and on the web as well now as the time goes on you're going to see a preliminary report then a factual report and so on and so on from the ntsb and eventually it could take six months it could take two years depending on the severity and the complexity of the accident but you keep checking the web and you'll see if they've got something new on there and in the end you'll find that they will publish the probable cause as well sometimes the they'll have a public hearing and the probable cause is announced at that these are some of the larger accidents that you might see with airliners and so forth i don't think we've ever had one and in the probable cause you know you can you can agree or disagree but there it is always on the web take a look there we'll also take a take a look at this thing from an internal company point of view we'll look at this report and say well you know this didn't cause the accident we don't have any reason to believe that this was bad but we did find something here that broke it really shouldn't have broken in this case and we'll take a look at that and see if there's something we need to improve in the product and so we we do that internally we'll have a meeting and kind of review the accident and bring in some of the engineers and people that can make some decisions and and review the fact that this broke and we need to maybe fix it even though it didn't cause the accident it could be a potential so we have critical people at this one and uh i think each company has their own process our sort of changes from time to time but but eventually we'll get around to writing this report which would look something like this these reports can be pretty pretty detailed and lengthy there's an awful lot of work involved there and finally the legal phase always somebody wants to sue you for something and you have to deal with it you know and so we usually first see that we're going to get sued when we were asked to produce documents which we do and then we have to go to wreckage inspections so what's once more they'll drag the wreckage out of storage and now the attorneys can take a look at it and we always go as well in case we miss something the first time around just to make sure that we didn't and to you know verify everything also keep everybody honest and uh we will also be deposed by by the opposing attorneys and of course we get into more component testing now these aren't necessarily the components that broke or we found in the accident but it could be an exemplar fuel pressure gauge or a pump or something and we'll be doing some testing there's always the contention that something failed this can take years and it goes on and on and on wreckage inspection starts with a basket of parts like this we'll lay it out like that and you know it goes on and on anyway we want you to have a a good day when you're flying we want you to keep the shiny side up and i may be a little early so we may have time for questions i don't know if there are questions on the floor we have a process waltz got the mic two questions uh dates for the f a a and ntsb dates that appear in the computer is that that actually do they appear on the date they are published or listed there or the actual accident date it's february 6 or yes they have the actual accident date there and as much detail as the report can give you is there these reports are refined and edited to a fairly well and they're pretty easy to read some of them are pretty long but they're as factual and as honest and straightforward as they can be i think they do a great job it's a very difficult job to do yes i had an engine out at one point about the november of 2007 and it was a piston failure and the engine kept running long enough for me to find an airport and safely land that's a good thing i land yes i'd land it as if uh it landed as if nothing had happened as nothing went wrong at all and and i'm heard that you know that's good news and bad news yes sir and the the downside is that since i landed and there was no loss of life or property the ntsb could care less they never came and investigated it i was told that the f a a was coming the maintenance shop where i landed sent me homes that get out of here we'll call the f a a we'll take care of everything two days later i showed up and said well did they show up and they i was told that they had but i never saw a report or anything or any record or anything um you probably need to contact the local fizzo there to see what it is they found because the f a will come out to these we would call something like that a fender bend or no offense but obviously something did break and and there could have been a good reason for it and uh we want to we want to know what that was why did that piston fail and um you know okay yeah analytical summary yep well typically there's the f a a has a lot more resources than the the ntsb just to give you a kind of a comparison the f a a has over 50 000 employees in 100 uh regional offices okay fizzos uh the ntsb has by law is by law limited to 500 employees most of which reside in washington there are 10 regions and about 39 i think right now maybe 42 active accident investigators 42 they're pretty thin so uh i don't know if that would report would be on the f a website probably not but if you go to the fizzo of where you were they'll they'll cough it up for you i'm sure yes sir what do i mean by party status means that you're a party to the investigation or a member of the investigative team it's a it's a crummy term we we're not having any fun out there i can assure you but uh party means you're a party to the investigation and it is it's a legal term and it's part of the part of the document that we have to sign it's called a party status agreement and we do have to actually sign it to become a member of the investigative team if you will they don't pay us you know we're still paid by our by our home manufacturer or home employer but but we do act on their behalf if they want us to go do something we all do it and um we do have our individual priorities but we don't do anything without their knowledge or permission it is their investigation make no mistake about that and because we can be invited we can also be uninvited so once we're out there if we we do something wrong and uh you never want to do that they'll ask you to go home that would be a very very long day in any accident investigator's career is to be asked to leave an accident trust me like we have a question over here yes sir yes um can you comment on the uh role that log books airframe and power plant log books play in an investigation and then what would happen if there was a gap if there's one logbook missing for example well any documentation is hugely important any investigation and we do our utmost very best to capture or contain or get hold of all of it while we sometimes can't necessarily get hold of the actual log we do look for facilities or copies of them typically the FAA will help us do that they have a lot of this on file but sometimes people carry their logbooks with them in the aircraft for example including their own pilot log and in the crash sometimes that evidence is destroyed burned up or broken or lost or whatever or it gets drained on or it's underwater and destroyed and so any kind of missing documents or any holes in those chain of words if you will really hurt us a lot because there are questions that come about then and we have to do what we can to fill in the blanks if the guy took it to his typical shop we may not have the logbook but we'll have the mechanic and that's a good thing i've got five more minutes left if anyone else has a question i'll be glad to answer it at this time where you can see me afterwards in the darkened studio where we can chat one on one as far as going back to accident um scene one one occurs and trying to find the historical weather what's a good site for us to find historical weather data um near accident site that's a really good question and i don't remember right now i'll tell you why there are vendors out there that you can pay to look up weather information that they store and you can go back to a given date to these people and say okay on this date or the day's preceding or following it can you give us the weather for Atlanta Georgia and the area and they'll cough it up they'll give you everything that's was ever published or or or metered and those professional people do a really good job they'll send us a packet about that thick and you can get very accurate weather that way that's how we do it now i don't know the site that's particularly good at it right now they're not cheap you know the the big packet of our reports that you showed up there real thickens on where do you store them and how long do you store them for life and do you transfer well each company has their own policy on document retention and you're you're supposed to have that down legally before you try to keep them or not keep them that has to be in your company's policies uh they're stored in a you know as you can imagine a safe environment we for example when we take pictures the original card that comes out of the camera is what we say we make a copy of that for our investigation purposes so all the original stuff is preserved and it will vary from company to company how long it's kept i'm curious i'm sure in some investigations the team is has a consensus and perhaps in other cases there's disagreement or ambiguity so are there cases where the ntsb ultimately comes out with a report that perhaps you might not agree with an entirety absolutely not very often but probable causes have been changed a friend of mine was involved in a accident right here at lakeland as a matter of fact and in time he he didn't agree with the probable cause and he took it up channels and i have to say i helped him but we opened it up it got it opened up again and all the facts were reviewed and in fact the probable cause was changed from pilot error so it can change they they say probable cause but they're always open and subject to to reinterpretation i think that's my cue i guess we can still talk is there a legal requirement for survivors to provide documentation like aircraft logbooks and pilot logs or is that something that is open to interpretation by the survivors well you know people people um you know a death of a pilot or any loved one is a difficult thing for any family to go through and we've had situations where they said yes we'll give you everything that charlie had we'll give you his tools and access to his shop and all his drawings and stuff and later on went to follow up on that and they wouldn't let us have it so it can vary from place to place it's very helpful to have the documentation to see you know what happened there if he's got the logs it's very very helpful if not then we have to go about other ways to finding it for example um sometimes you know people that flew with them or or friends or so forth sometimes they'll come forth with with information somebody may have helped him build the airplane for example or worked on it or did the annual and so you can get the information kind of in a different way it's best to get the written document but sometimes the family just won't cough it up so i think uh you know it's a very important piece of it but we don't always get it again back to probable cause i really appreciate your help today and uh the fact that you came out here so early in the morning to listen to us and there's something we can do to help you don't hesitate to call i'm retired now but i'm still working at it thank you very much for your time thank you mike thank you wall stay right here stay right here now we know what you do when the phone rings that's right because it rings very much it used to ring a lot oh that's bad in that business well sometimes it's the same uh you know same accident 14 people call you so i understand that's like on the highway yep yeah i was on the side of the highway for 16 hours nobody called there you go yeah i don't get no respect you and rodney if there's anybody has any questions please come up and see mike you might have a personal question i'll be glad to answer it there's a lot of information out there in particular if you start at ntsb.gov it'll lead you back to some of these other sites and accidents yes thank you stay ready we're still on camera okay liven in color hello there young fella okay okay i wonder i'll tell you it's very simple there are two mike bush


Now we're getting to Heap to memory management and what heap to choose. There are actually five types of heap Each one will provide you with a different memory allocation memory freeing and It's usually completely different scheme. So I will try to explain in next slides Yeah, as said before for FreeRTOS, there's a specific memory area in which you have a heap. In this heap There might be some freeRTOS resources that was selected before that you initialized like some tasks, queues Every queue and task has its control block Which is located on its own stack. If you are running your application without freeRTOS You just simply call malloc or free for dynamic allocation But if you are in a operating system, you need some thread safe functions In this case, there are two dedicated for this Operations, pvport malloc and pvport free. You just don't use free or malloc You need to specify total heap size in the FreeRTOS config header file and if you are not sure if There is enough of the space for the heap you can call xport getFreeHeapSize function which will return the value of the heap space unallocated Each task or even queue or other resource need to have its control block and This allocated in the heap you can enable some task notifications Trace facility and the mutex is in the heap Usually this is already predefined and you can define it in a kubemax But if you really want to change it later, you can do it do it in a kubemax and then regenerate or You can go straight to the configuration file and change these values right there But this the change will be not propagated if you regenerate the project the control block size is depends on the option that you enable in the Configuration file when creating a task you need to pass the stack size dedicated for this task as an argument in the Thread def function that you can see at the very beginning at the very end of all the arguments in the function For each task there is allocated the control block size Plus four times task stack size. The reason is that the number is given in words You need to define as well the minimum stack size and this size is taken by idle task When you run your tasks and you need to know how much memory was used by the task the Friartos uses a Method of counting the known keyword in the stack So when the stack is defined in the heap It is filled with a known value that normally should not be present anywhere in the program execution When you want to know how much memory was allocated by your task in its own stack You can test for the watermark this is The last modified word in the memory. So when you call the function of UX task get stack a high watermark Function will take the ID of the task that you want to present or a current one and it will traverse the stack of this task and it will count how many words are still unchanged and This will give you the watermark. Hey my stack allocated only up to this level and everything else is available so if you take from the TCB the length of the stack and The watermark you can subtract them and you automatically know how much space wasn't used So it's a reserve for you or the stack can be reduced by this amount to spare some memory It's a very useful thing because When you define the heap You must define its size so that all the objects fit inside But the whole heap fits as well in your memory, which can be quite complicated when we speak about other objects the Objects take as well some amount of bytes in the heap when their Object is created. So when I create a message queue, it takes number of elements multiplied by element size plus some default thing like 16 bytes for description of the queue and so on Additionally when we operate with software timers then again we have to enable the usage of the timers with a macro and when the timers are added to our Configuration during initialization of the kernel the timer task is created. It's additional task that Is responsible for processing the timing events So if you create a software timer the timer task will take care about the proper scheduling and When the proper time comes for your asynchronous function the timer task will call this callback and Will pass the control to this asynchronous function So you can schedule that For example every five seconds or in 20 seconds or in 50 milliseconds. I want to call this function So you put it into the timer queue the timer task will order the events Depending on the time and it will wait until the proper time comes then it calls the function Be aware That the function is called in the context of this timer task Which means that your function will share The stack with the timer task, which means when you create the timer task You have to define stack big enough to fit as well the variables of your callback functions It's a typical mistake where you leave the timer task Like it is with some small stack and you put a function that uses a lot of local variables And then everything works and suddenly when it comes to this function It still finishes properly But when it returns to the other functions suddenly you get strange crashes of the application why because local variables of the function called in the timer task Overwrote some other data from other tasks or other objects and when it for example overwrote the structure of the queue or a mutex well, then It's destroyed and when you try to use it it has very interesting effects typically It's very hard to debug at that moment. You would need to take the list of the tasks and look at the usage of their stack and If you see that the timer one is completely full and exhausted You have to increase this parameter additionally You can as well play with the priority of this timer task if you want the functions running at a very high priority So at a precise time you should put as well the timer task at high priority but if of course You don't want to disturb your code You can put the timer task to an idle or low priority and then the functions will be executed When other tasks are finished and give up their time Additionally for the timers there is still a Need to define a queue length for the timer because each record means the initial time the length of the delay and the callback function and You if you want to plan a lot of different tasks You have to increase the length of the timer queue to be able to put these events in the queue so that all of them fit and Additionally semaphores require 88 bytes to be allocated in the heap So if you don't want them You can as well exclude mutex's by disabling the use mutex's macro in the free artist configuration The question is how to reduce the usage of RAM RAM Will always be a short or a very expensive thing So when you design your application again, please check how much RAM you use in different objects Some of them are necessary. So you have to count with them however for tasks you should check how much memory you use and Reduce the stack size in the definition It's a little bit dangerous thing you always have to leave some margin because For normal input parameters For normal behavior of your application The task can run in a simple loop or the depth of the function call can be limited can be calculable But in case you get the wrong parameters or Some unknown or unexpected value of parameters It can be by application mistake by a mistake of the incoming data such task can get into the cycles and Especially if it's re-entrant If it calls a function that calls itself or other function and there is a circular loop The stack with the wrong input parameters can be exhausted very quickly so you have to count with that and The trouble with testing is that you can either test everything or Just values you think can happen. You have to be careful how you define your applications when something happens and your stack is corrupted and You get a task switch To the task whose stack is corrupted the Friartos can check this situation and When such situation is detected by the watermark check and by a special area at the bottom of the stack check It will call a hook Called application stack overflow hook This is an empty function but this function can be adapted by you and At the moment when you land in the application stack overflow hook You know that something bad happened and the the stack for a given task is destroyed So what you can do at this moment? first record this event and if The application allows that you can try to restart the microcontroller very important thing is you probably would want to record such and You would as well want to record the parameters from a given task If it started with some values It may be worth putting them in the trace So it's very important to have some lock of your function Especially in case of errors because you can learn from them and you can try to adapt your application later in the next version but Please use the application stack overflow hook because it can tell you that something really happened and You should care about your application again.  Do you know why? You can still have 10 kilobytes of the heap available But you can't allocate a block with a 1 kilobyte in size The function returns a sum of all empty blocks But the empty blocks can be between Already allocated parts of the heap and if you sum them and each of them has a half kilobyte in total They can have 10 kilobytes But if the biggest block is half kilobyte You can't allocate a new task with a three kilobytes of the heap knee or the stack needed It's a double-edged sword on one side It gives you the empty space on the other side. It doesn't give you how much you can allocate at once Concerning the heap allocation we will see different strategies for Allocating the heap and you can choose these strategies in the configuration and the cuba mix will reflect it by including One of the five files that implement different heap allocation strategies When you look at the the design of your application if you need to reduce the rum please write down the usage of your stacks using the high watermarks for each of them and Try to reduce the size of the stack for each of your tasks and Try to think as well if you need so many tasks if for example some functionality can be combined together To use just one task and one stack for a given functionality then Think about usage the timers whether you need to use them because this way you can reduce the footprint by By the stack of the timer task by the tcb of the timer task by the q of the timer task So it gives quite a big benefit not using them same is valid for the mutex's and other elements so Reduce from the configuration all the elements not used in your application further we can think about using a Macro maximum number of priorities of the tasks because the higher Amount views the more memory we need and the less efficient algorithm can be used for Distinguishing which of them will run So reducing the number of priorities can help as well. So let's look at the memory allocation We can choose the total heap size in the configuration Which is a parameter that reserves and typically variable in the memory or heap in a memory and This will be passed to the free articles Then you have to choose as well the algorithm how the memory is allocated and Deallocated it's managed by a heap one to heap five and Now let's look how the heap operates. So We have got the stack for the main application So when we start the micro it needs some some stack for calling different functions calling startup functions clock setup and so on Then there is a beginning of our memory where the standard C heap is defined This can be pretty small for example only for a print F because the standard C functions use the system heap and This system heap has to be defined. It can be very small, but it has to be there further and the free articles heap is defined as a variable or block of memory defined in the RAM beyond the main application heap and Before the main stack So it's a block that you can allocate you can say how big it will be and The rest of the memory can be allocated for global variables when you define the heap and The strategy how to use it? You are telling free articles. Hey now you can use this memory and it's under your control so that's how The free articles gets its heap. Just give it. This is your memory. This is this size in case of a strategy heap 3 the free articles uses the standard malloc and free functions so at that moment you are responsible for defining the application heap and The free articles uses standard C functions to allocate and allocate it so let's look at different models of memory allocation and Why the fragmentation can happen? In a heap one strategy This uses a first-fit algorithm. So when you want Allocation when you want a chunk of memory with a given size the heap one will simply take Free first empty part of the heap it will allocate the newly Requested block it will return the pointer, but heap one doesn't offer any Deallocation and here in heap one. What do you allocate? You can't remove from the memory It has got this drawback. You can't reduce The memory footprint if you don't need something So it stays in the heap forever But it has an advantage if you have application with a fixed amount of objects It's very effective Because it doesn't need to search for empty blocks It simply takes the last one and puts your request on top of the last one so it's very fast and For safety applications where you don't want to deal with a dynamic memory allocation This is the best option because if you set up all the objects at the beginning You know that you have all already placed in the heap and there is no danger of running out the second strategy heap 2 uses a very limited way of emptying blocks So you can see I'm allocating at the beginning three objects So it allocates three blocks in the heap then I deallocate two of them and Suddenly these two Become available, but If I deallocate even the last one You can see that there are four blocks that can be allocated. However, they are not Defragmented so you have got four isolated blocks Where you can still allocate less or up to the maximum size of the block, but not more So heap 2 is not recommended because it keeps the memory very fragmented and If you place a lot of small objects and you fill the heap and then remove these objects You can't place anything bigger than heap 3 strategy Uses the C library functions malloc and free So the implementation whether the memory stays allocate Fragmented or the fragmented depends on the implementation of these functions Trouble with that is that you don't have control how these functions malloc and free are Implemented you typically don't have a source code from them and They tend to be rather slow One of the better options is an algorithm implemented in heap 4 Heep 4 uses free space the fragmentation. So whenever you free a block It looks if the surrounding blocks are as well empty blocks and if they are It connects the blocks together so at the end when you deallocate all all the blocks or Couple of them it keeps the blocks in one big chunk that allows again to allocate bigger objects So heap 4 is a preferred strategy yet It has One little disadvantage. It is still defined as one variable So it fits only into one memory. You can find the definition of the heap 4 As a definition of this you see heap variable array. So you can see that It's defined You can place it using linker or different attributes to different addresses or different RAM memories If you look at a memory map of our new microcontrollers, you can realize that There is quite a lot of separate run blocks For example a steam 32 h7 has something like six or seven memory blocks and These memory blocks are in not a continuous space. So one RAM begins at address 20 million hexa the other RAM blocks begins at address 30 million hexa So in total you may have a one megabyte of RAM But it is not a continuous space So if you use heap 4 strategy, you could either choose a half megabyte block or 256 kilobyte block But not one megabyte in total Which is solved by using a heap 5? This is similar to heap 4. However, it defines a table that describes several different blocks each block with its startup address And the size and it finishes with a null and zero vector So when you choose the heap 5 and you call the port define heap regions you put a pointer to this table and Friartos is then able to allocate the requested memory size in any of these blocks So suddenly you can use all the memory available in the microcontroller. Of course the Allocated block will not cross the boundaries Because it's a discontinuous RAM But it can still allocate the blocks in RAM 1 in RAM 2 RAM 3 RAM 5 So it gives you much more RAM for the application usage We can as well use alternate functions to operate with the memory because Friartos Has the option to use a pool. The pool has one advantage. It defines memory blocks with a fixed size and It allocates to you the blocks of a fixed size from a defined pool So the management of these pools is simpler than dynamic memory allocation On the other side It is not a recommended way of operation Apart from some communication tasks for example pools are very effective for TCP IP Where you need to take the packets of the memory and Return them back quickly So pools are much faster for implementation and for runtime But if you need to share different sizes of data dynamic allocation is better


Ray Mulan, Edmund Gwynne, Alan Young, star on Family Theater. The mutual broadcasting system in cooperation with Family Theater Incorporated presents The Leprechaun Who Didn't Listen, starring Alan Young and Edmund Gwynne. Three portions are transcribed. Ray Mulan is your host. Our Family Theater story this week is about a leprechaun. That's right, a leprechaun. One of the little folk from Never Never Land. Everything about this leprechaun was fine, except that he wouldn't listen, wouldn't listen to anybody. Many of us are like that. Many fathers and mothers constantly hear of the dangers threatening the good spiritual and moral life of their family, but too often they don't listen. They forget to turn to God and ask His help through daily family prayers. They forget that the family that prays together stays together. Maybe it's time we started listening where our family is concerned, because they're the most important possession we have in the world. But about that leprechaun who wouldn't listen, his name was Johnny. Maybe it better let Edmund Gwynne tell you all about it. Once upon a time in the days when the good folk inhabited the earth, there lived a little leprechaun named Johnny. Now as you know, all leprechauns are by nature shoemakers, and they possess the secret of wealth. If you ever catch a leprechaun, he's forced to tell you the secret. Yes, but a leprechaun is very hard to catch, for he's just nine inches tall from head to toe. Now Johnny leprechaun was doubly hard to catch because he was just a youngster and he was only a four and a half inches tall from head to toe. Johnny was a pride and joy of the good folk and he tried very hard to learn all the things that would make him help to grow up to be the finest leprechaun in the whole fairy kingdom. But once in a while, like little boys today, Johnny didn't listen. Now that's why we have a story to tell. Pop. Why do I have to learn to make shoes? Don't ask foolish questions. Why, Pop? All leprechauns are shoemakers, you know that. Why, Pop? It's tradition. Even back in the days of King Oberon, we were shoemakers. Who was King Oberon? Johnny, you haven't been studying your history. King Oberon was king of all the good folk. Ah. Well, who did you think he was? I didn't know. Pop did any leprechaun ever get caught and have to give up the secret. Just once a man named Midas tricked him and Midas became real wealthy. Wealthy? Huh. He cleaned up. What happened to the leprechaun? He lost his union card. Pop. Do you think I'll make a good leprechaun? You shut up and stop asking so many questions. Now, today, children, we take up invisibility. Do any of you know what invisibility is? Well, you're invisible when you can't be seen. Only the good folk know how to become invisible. And the magic trick is only used when absolutely necessary. Naturally, leprechauns have to know how. It helps us to escape when those silly humans chase us to learn the secret of wealth. Eh, Mildred, pay attention. To make yourselves unseen at any time, just say, listen Midas, listen Mores, land of enchantment, open your doors, then cross your feet, spin three times in a circle, and poof, you're gone. We'll take this side of the class first. That afternoon, Johnny went to a deserted part of the enchanted forest, where the good folk hardly ever went. And he determined to practice the spell until he could do it perfectly. First, he forgot the words. Then, he got twisted up. And when he had the words right, he'd cross his feet and spin in a circle. And he'd get so dizzy, he'd lose his balance before he'd gone around three times. But finally, he thought he had it mastered. He sat down on a twig to get his breath. And then he concentrated very hard and began the spell in earnest. Listen, Midas, listen Mores, land of enchantment, open your doors. And wonder of wonders, the spell worked. Yes, when Johnny stopped spinning, he looked down at his body. Oh, he was slowly fading away. And then, he was gone. Gee, it worked. I'm invisible. Waddle the kids see this. For a while, the little leprechaun danced around, playfully enjoying his mysterious new state. And then, oh, the thought hit him. He hadn't learned how to reverse the spell. Pop, this is important. Yeah, it can wait. Pop, look at me. Johnny, where are you? No, stop playing games. I'm right here, Pop. I'm invisible. Oh, no. What's the matter, Pop? Did they teach you that in school? Yes, sir, today. I've had trouble enough keeping track of you before. Now, I don't know what I'll do. What did you want to know? I want to be visible again. I'm hungry. You're always hungry. Well, just work the spell. There's no problem to that. I can't. You can't? Oh, what's the matter? Are your tongue tight or have you forgotten it already? The teacher didn't get that far. It's a fine place to stop. We weren't supposed to do it all the way through. Oh, I see. And little Johnny Leprechaun had to be the wise guy, huh? He couldn't wait with the other kids. Oh, no, he had to try it all the way through. I'm sorry. You're sorry. What good does that do? I thought maybe it would do some good. Well, it doesn't.   Oh, no, now you come here invisible. Oh, well, now, now, now there's no use crying about it. I'll be good, Pop. I promise. I'll never do another bad thing, but please tell me how to be visible again. That's just it. I haven't used that spell for years. I don't remember. Pop wrecked his brain, but he couldn't remember the spell no matter how hard he tried. So he sent Johnny to the teacher. I told the students not to finish the spell. Oh, I was afraid something like this would happen. Johnny, you will stay after school every night for two weeks. A teacher? That's my decision. And you must never, never do anything like that again. But Johnny didn't listen. No. And of course, since he had to stay after school every night, this meant that he wasn't getting his sleep as a growing leprechaun should. So one day, nearing the end of the school year, and so children, that is the secret of welfare. Remember, you're unabound to tell any person who catches you, but you must do everything in your power to keep from being caught. Yes. Class dismissed. What? Gee, I must have been asleep. Yes, Johnny was asleep. Just when the most important thing a leprechaun had to know was being discussed. The secret of wealth. Naturally, Johnny didn't know what he'd missed, but he was embarrassed at falling asleep. So he said, listen, meadows, listen, wars, land of enchantment, open your doors. And he faded right out of the classroom. It was late afternoon and the sun was lying in warm pools on the forest floor. It was a perfect day to go exploring in the mind of little Johnny leprechaun. So still invisible, little Johnny skipped and danced along, going deeper and deeper into the depths of the enchanted forest. Yes, he went much further than he'd ever had before. Finally, he wasn't quite sure just where he was. And he came up in a pixie sleeping under a tree. Now, as we all know, pixies are very small, but the ones in the enchanted forest were over two feet tall. So they looked like giants to nine inch leprechauns. And this pixie looked like a mountain to Johnny because Johnny was a youngster. And he was only four and the half inches tall, from head to toe. Johnny led a sheltered life. He never met any other families of the fairy kingdom, but he had seen pictures of pixies and he knew they were very big. So there was no doubt about it. This was a pixie. Gosh, he's so big.  Johnny thought it was the most unusual sight he'd ever beheld. So naturally, he had to go just a teeny bit closer. And just then something got in Johnny's nose and tickled it. He was standing right by the pixie's ear and he tried and he tried to stop what he felt was coming, but all of a sudden, the huge pixie reached out in the direction of the sneeze and because his arm was so long, he grabbed Johnny before he could move. Well, one of those scrawny little leprechauns. I am not scrawny. That's your opinion. Do you know who I am? Yes, sir.  That's right, my pint-sized friend. I'm Black Peter. I own the whole of the Enchanted Forest. I'm your landlord. I'm the wealthiest being in the Fairy Kingdom. Oh, I don't know. What do you mean you don't know? I know someone who's much richer. Who, who, who is he? Well, if you let go of me so I can breathe, I'll tell you. You'll tell me anyway. Please, let me down, Mr. Pixie. I feel dizzy. Do you promise to tell if I set you down? Oh, of course. Well, all right. Now, who is the richest in the Fairy Kingdom? The leprechauns are. They know the secret of wealth. And with those words, the naughty leprechaun ran away into the forest as fast as his little legs would carry him. Black Peter was furious. But Johnny had slipped away and all the angry pixie could see were the pools of sunlight on the forest floor. Johnny warped and warped and before long it was growing dark and still was no familiar sign about him. Oh, soon the terrible realization came to him. He was lost. He sat down and cried, cried until finally he curled up on a leaf and went to sleep. The night spread her velvet mantle over the Fairy Kingdom. And the mantle's thousand jewels that mortals call stars twinkle and cast their reflections on the drowsy earth. And in the darkness, a shadow moved silently between the great trees toward the home of the leprechauns with a message from Black Peter. The leprechauns read the message and the news of what it contained spread like wildfire through the community. Glow worms lit up as the little folk got out of bed and that leprechaun local 47, they gathered for a meeting. And for us is to get out. I think shortage in the Fairy Kingdom. The only possibility is mortal meadow. Evacuation was begun. The leprechauns worked feverishly packing their belongings for the trip and they worked so hard that by dawn there wasn't a trace of a leprechaun in the whole enchanted forest. Except for one naughty youngster asleep on a leaf. Oh, it's morning. I know where I am. To assist him, Johnny recognized the landmark and was soon skipping happily homeward. The more familiar things he spied, the faster he went. Until at the end he was running. He ran right up to his old home and stopped. There's nobody here. They're all gone. Where is everybody? If Johnny had only listened before, he would never have gotten to trouble at all. But you know, once you stop listening to good advice, you get in deeper and deeper and deeper. So Johnny threw himself on the ground and cried his little heart out. Suddenly, Johnny heard a noise and footsteps coming closer and closer. Who's there? I recognize that voice and I see you this time. What seems to be the trouble? Where have they gone? All your fellow leprechauns. You're the wealthiest being in the forest. Surely your wealth has brought you the answer. Oh, no, sir. I don't have any money. I'm just a little leprechaun. Changed your tune, haven't you? Well, I think I've taught you leprechauns a lesson, so I'll tell you, I raised the rent. Ten pairs of shoes a month. So they moved. And I'm rid of their noisy cobbling. And do you know where they moved? To mortal meadows. Johnny was horrified. He knew it was all his fault. Still, the feeling didn't last long. No. No, at mortal meadows, his father gave him a scolding of his life. But it went in one ear and out the other. And the first thing Pop knew... Pop, Pop, what do humans look like? What do you want to know for... I just wonder. If you just see that you're never caught for one, I'll be satisfied. But how will I know to run away if I don't know what a human looks like? All right.  It's bigger than the great bushes on the meadow. It's bigger than this community. Now, are you satisfied? Yes, sir. But Johnny's curiosity wasn't satisfied. No. There were humans nearby and he'd never seen one. So what do you think he did? Where are you going, little leprechaun? Mr. Pixie, where did you come from? From nowhere and everywhere. That's where Pixie's always come from. But you haven't answered my question. Um, I'm not going anywhere. I'm wiser than that, my friend. I know where you're going. You want to see a human, don't you? How did you know? Professional secret. But don't be afraid. I don't want to stop you. In fact, I'll show you the way. So Johnny and Black Peter went through the green forest and over the hills to the village. And there, Johnny leprechaun saw his first human. They were huge, clumsy things, three times the size of Black Peter the Pixie. Peter led him through the streets until they came to a great house, from which drifted, oh, all the most tantalizing aroma Johnny had ever savoured. What's that smell? That's pies, baking. What's pies? A wonderful human delicacy. You'll see. Get on my back and we'll climb up to the windowsill. I'm afraid. Go on, or you'll never know what a pie is like. Okay. That's it. Now, take a bite. Oh, it's wonderful.  Eat some more. We're even now, my foolish leprechaun. Peter laughed so loudly that the woman rushed to the window to see who was trying to steal one of her pies. But Peter was gone, and only little Johnny remained. He tried to make himself invisible, but just then he fell flat on his face in the pie. Then he felt himself lifted right up into the air. Well, Faith, and what's this? A bird? No. It's like a doll. Only not halfs, a big. Let go of me. The saints be preserved, it talks. You didn't think I'd catch you, did you? Mr. Pixie, help me.  Isn't that a fact now? Yes, ma'am. And if you catch a leprechaun, he has to tell you the secret of wealth. Yes, ma'am. Well, tell me quickly, what's the secret? Speak. I've caught you fairly. Tell me how I can become rich. I don't know. You don't know? I guess I was asleep in class that day.   And with that, she threw Johnny pie and all right out of the window. Of course, the word got back to leprechaun local 47, that one of their members had disgraced them. Yes. For as Johnny had been taught in school, each of them was on a bound to reveal the secret of wealth if he was caught. Ah, there was great sadness in mortal meadows. Yes, the bad little leprechaun who didn't listen was never heard from again. All the other leprechauns were so ashamed that they all moved to the south pole and became penguins. This is Ray Meland again. I hoped you liked the story of Johnny, the leprechaun, and I hope you didn't feel too sorry about his coming to such a bad end. After all, Johnny never really did exist, except in the eerie world of the little people. But there are people for whom he should feel sorry. Those men and women whose marriages are failing because they've allowed no place for God. Those families which are breaking up because they've forgotten the help that can be obtained through daily family prayer. Begin family prayer in your own home today. Find out for yourselves that the family that prays together stays together. Thank you for being with us and God bless you. Our grateful thanks to Alan Young, Edmund Gwen, and Ray Meland for their appearances, and to Marvin Bryan for writing our play. Original music was scored and conducted by Max Tehr. This production of Family Theatre Incorporated was directed by David Young. The supporting cast included Ed Max, Arthur Q. Bryan, Howard McNair, Junius Matthews, and Gloria Gordon. Next week our Family Theatre star will be Stanley Clements in For the Love of Angel. Your host will be Jack Haley. This series of the Family Theatre broadcasts is made possible by the thousands of you who felt the need for this kind of program, and by the mutual broadcasting system which has responded to this need. Be with us next week at the same time when Jack Haley and Stanley Clements will star on Family Theatre. Your announcer, Merrill Ross, this program came to you from Hollywood. This is the Mutual Broadcasting System.