I didn’t do a lot of things on the project since last Wednesday.
Nonetheless, I managed to make the sotware audio codec work!!! Now, I’m able to stream whatever mp3 file on the serial link, decode it on the micro-processor, send it to the codec and hear it in my earphones. I don’t really know what were the errors in my previous code, but now it works and it’s the most important. We have our first completely finished driver, and that’s a good thing as it doesn’t remain a lot of time before the final deadline.
I also had a look to the server. I managed to deploy the database on heroku (a PostgreSQL database was required), but it has a very strange behaviour: if you read it several times, you don’t always have the same result, and the result also depends on the device you use to access the website. So it’ll be necessary to have a look to it. I also read some documentation about Pyramid to really know how it works (I hate doing something without knowing what I do). Finally, I spent some time looking for a way to add security to our server (authentication and authorization). I found one library that allow the users to log in with their Google account, but it doesn’t work with Python 3.x (only Python 2.x). So I’ll continue to look for a better solution.
And our PCB will be sent to the factory tomorrow evening. We must receive them 6 working days later, which is a good news as it will allow us to work on it during the Christmas holidays.
During next week, I will focus my efforts on the server, in order to have it finished when we receive the PCB.
As said in my last post, I finished the routing of the PCB. Alexis made some reviews, and I did the corresponding corrections. It should be ok now, and the PCB will be sent to the printing factory soon.
I also (it occupied most of my time on Monday and Tuesday in fact) worked on the audio codec (again). You’re possibly fed up with it, and I understand you. I’d never thought it would be so difficult to make it work. But everyday, I go one step further, so I can’t abandon it (and I really want it to work, so I won’t abandon). Now, I’m able to play any music stored in flash when it’s presented as a single block to the software codec. And I can play one music (the one I’ve used for my tests until now) even when it’s read by chunks (and on Tuesday morning, I could send it through the serial link and play it, but on Tuesday afternoon, it didn’t work anymore, don’t know why). But it fails when I try with other musics… I will continue to work on it.
Finally, today, I deployed our (basic) server on Heroku. I spent some times trying to understand how to use
git subrepo. And it’s still not completely clear in my minds, even if it seems to work. The database doesn’t work for now on heroku (due to an error caused by waitress), a deeper analysis will be required to fix this problem. And I also wrote a template html file to display the content of the database (the leds values).
During the end of the week, I’ll try to work on the audio codec to solve the last problems. And I will work on the server also (to make pauses between 2 work sessions on the audio). If both work well on Sunday evening, I’ll be very happy.
As said in my last post, we worked on the PCB, on the sound and on the server. But contrary to what was said, it’s Tanguy who worked on the server and I worked on the PCB. On Friday, I made some minor changes on the placement and then I asked for a review from Alexis. He helped us to improve the placement and validated most of the choices we’ve made. After having applied his suggestions, I started to route the PCB. It should have taken no more than 30 minutes but I spent more than 3 hours and it’s still not finished… I hope that it doesn’t hide a bigger problem in our PCB.
I also talked with Samuel about my problems with the sound and he suggested me to use mailboxes. On Friday evening, I implemented this idea and now I have another problem: I can hear the music but also many other things… I have to investigate to see where this problem comes from (it’s related with what I send to the codec I think, so I’ll have a look on this aspect first).
For next week, I will continue to work on the audio and on the PCB. And maybe on the server also. My objective is that the PCB is ready before Wednesday and that the sound and the server work fine before the end of the week.
Since last Sunday, I mainly focused my work on 2 elements: the schematic and the audio decoding.
Let’s start by the schematic: on Sunday evening, I changed the voltage regulator in our schematic because the previous one was too weak: in case of current peaks (expectable because the supply block is not perfect), it would have burnt: not a good idea. The new one is much stronger. And I also added the powerful LED. Then Alexis reviewed this schematic, and I made some corrections. After the last corrections made by Tanguy on Tuesday, our schematic seems to be good enough so that we can start the placement/routing phase.
Alexis proposed us to use a small motor instead of a servomotor to make the leaves move. A quick test showed us that it wasn’t a good idea: the motor he gave us to test rotates far too quickly. He also showed us another servomotor, the HD1370A. I tested it and it seems to meet our needs: it’s small, rather powerful and cheap. We will thus use it for our project.
Since Monday, I work on the software audio codec. Samuel helped me on Monday and showed me that the first one I’d found couldn’t work for our project because it requires a Linux system. He found another one, which can work on a bare-metal system. It’s called Helix and the API is quite clear, but it lacks a good documentation. By chance, I found several projects for STM32F4 that use it, so I can see what functions they call, when and in what order. After several hours of work, I finally managed to decode a mp3 file stored in flash and to play it on my development board. There are still some imperfections in the sound produced and I have to investigate a bit to find where it comes from.
For the second part of the week, we have to work on the PCB. Tanguy will probably do the main part of this job. I will continue to work on the software codec, in order to find the remaining errors and I will have a look to the server (that will be written in Python using the framework Pyramid).
During this second part of the week, I’ve tested several servomotors to help me choose which one was the best for our need. And I still don’t have a don’t have a final answer. The HS81 seems good but it’s quite expensive. As this choice doesn’t have impact on our schematic and PCB design (we just need a 3-pins connector, whatever servo we choose), we still have some time to take this decision.
As I said last wednesday, I tried to improve the communication with the CS4344. I improved it because now, I’m able to send the data to the codec using the DMA, which is good as it doesn’t use the microprocessor. But I still have a problem: the music is played too quickly by the codec. I analyzed every signal coming into the codec in order to find a difference between Samuel’s code and mine, but I couldn’t find any difference. I’ve missed something for sure, because there is an explanation (I’ve always been told that a computer does exactly what you ask it to do, not more not less, so the error comes from me).
I didn’t have time to test the software codec on the development board this week (in fact, I preferred starting to work on the server).
I’ve also added one powerful LED to the schematic and modified a little the pin allocation on the microprocessor. We just need to change the voltage regulator and add the last resistors and our schematic will be finished (except if Alexis finds mistakes in it).
Next week, I will focus on the server code and if possible, I’ll test the software codec on the development board.
This week is fully dedicated to the ROSE project so I had time to work on several aspects of it.
The audio codec was the most time-consuming one because I spent hours trying to understand why I wasn’t able to play music on the board. As Tanguy said, I managed to have the I2S work last Sunday afternoon but it was no the end of my problems. Because yes I was able to talk to the codec but we didn’t understand each other. I explored several ways in order to understand what I was doing wrong. I expected that the problem was related to sampling frequency because that part isn’t clear to me: I don’t clearly understand which signal corresponds to what value. But it wasn’t that. Samuel found a code he used for the 2014 communication challenge and that was able to communicate with the codec. I adapted this code to the new version of ChibiOS and it worked !! I still have to change a bit this code in order to use the I2S driver that was added in ChibiOS in the meanwhile (it uses DMA, so it’s better than doing it by hand on the microprocessor). And I also found a software codec made for running on embedded systems and that is able to decode ogg files. With this 2 infos, we validate the choice of the CS4344 as our audio codec (as Alexis suggested us to do).
I also made some tests with the Flexinol and our banana tree, in order to see if I was able to move the leaves. And the result was very disappointing… So I tested with a simple motor and a wire and it worked very well. With this solution, the result is really convincing (according to me at least). When I showed it to Alexis, he approved my choice: we’ll abandon the Flexinol and use servomotors instead.
Finally, I tested the most powerful LED we have (the one which was abandonned few weeks ago) with the optical fiber, to see if the light was visible even during the day (because with the other LEDs, it’s only visible by night). And it is, so we decided to add one powerful LED to our product in order to make some flash visible even during the day (to signal that you’ve just received a message for instance). We take only one of them, because they need a very high current (up to 2.8A each).
During the second part of this week, we want/have to finish the schematic and the placement/routing of the PCB. Tanguy will probably do most of the job on this part. So I will try to improve the communication with the CS4344 and test the software codec.
This post will be shorter than the others for 2 reasons: Alexis asked us not to work to much during this long week-end and my work has been unsuccessful.
Since last Wednesday, we focused with Tanguy on trying to use the audio codec on our development board, in order to see if it’s possible to use it in our project. And since Thursday, we’re stuck trying to use the I2S to communicate with the codec. We both spent hours trying to make it work, unfortunately without any success until now.
I also tried to use a software codec to decode ogg files and convert them in PCM signal. I spent some times to understand how it works (the provided Makefile is 674 lines long so it takes some time to understand what is really important). And then, I tried to use it on my development board but it requires some system files that it can’t find so I have to investigate a bit to see if it’s possible to do without them or to provide stubs for them.
Next week will be fully dedicated to the project so I want to have the codec work and to finish the schematic and the PCB before Wednesday evening.