Support for STM32 Nucleo? #640
Replies: 34 comments
-
Posted at 2014-10-17 by @gfwilliams Hi - thanks for the suggestion... It's quite a good idea to have a way to maybe do an 'in-app purchase' to get support for other boards. However the work that needs to be done is not in the Web IDE, it is in the Espruino firmware which goes onto the board. Once that is done it'll work on the Web IDE without any changes required. The issue really that everything is Open Source, so if I were to add any restrictions to the Web IDE or Firmware then someone would just copy it, remove the restriction, and put it online elsewhere. I did try a donate button in the past, but so few people used it that it wasn't worth having - I guess I could try something a bit more obvious - like Ubuntu's download button. It's kind of a hard situation - I got given a very hard time for not being Open Source before the KickStarter, but now I am Open Source it makes it difficult to do things that might actually be in everyone's best interests. Anyway, I'm sure you'll find other rants from me about it on the site :) If you do want to try and port to the Nucleo yourself, it shouldn't be too painful. There's some info here: https://github.com/espruino/Espruino/blob/master/README.md Basically you need to get your computer set up so you can build Espruino for ARM, then you just create a new file |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-17 by ac413 Thanks for your quick response. I should have read the readme.md on github first. I did not expect such clear, detailed , support in the readme file. You really have a great company that is doing great things, so thanks again. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-26 by asez73 Hello, I have started some development around the NucleoF401RE board and Espruino 1v71. So contributing to the Espruino interpreter project is my intention. I definitively will not attempt to provide a serious/permanent support for this board... Linked file is a rough log, all keystrokes included, of a session with gtkterm... Still have to try Web IDE for instance.Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-26 by @gfwilliams Hi, that's great news! Strange that setWatch doesn't work though - the 401 chips I've been using here seem to work ok with it. To contribute back, just issue a pull request on GitHub (using a branch means you can do other stuff on your repo without modifying the pull request as time goes on). As long as the changes don't impact other boards I'll try and pull them in. If you could update the readme with the state of the board's support it'd be really handy though. thanks! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-27 by asez73 Hi, in fact what might impact others boards is mainly: 1-modified: ./Makefile 2-modified: ./scripts/build_platform_config.py Everything else is actually new files added under ./boards/ subtree. So, I think my changes are harmless for other boards while my additions should also be harmless although unreliable so far. No C code was written or modified... By the way I found the contributing.md file which explains your requirements. Two questions: b- The NUCLEO boards do have an hybrid connectivity which creates a conflict about pin names: Arduino's analog inputs are names A## and the Espruino names are also A## to H##. You, logically, shortened the names as defined in the STM32F401 manuals by removing the leading "P". This makes A1, for instance, a valid name for both standard naming rules although the actual pins positions and functionality are totally different. Do you have any suggestion about how to name the Arduino's pins and the Nucleo's pins without breaking the already applied rules for the different boards? I am also surprised that, for instance, setInterval works perfectly while setWatch doesn't at all. Actually holding down the user button is correctly read ("analogRead(BTN1)" answers 0 if pressed down, 1 if not pressed). Or is it a reversed logic problem when compared to Espruino board's user button? I confirm that save() won't make it although the console log shows that it did it correctly. A "reset()" followed by a "dump()" won't show anything saved. Finally, the web IDE works correctly. I just have an other problem with a character left in the input buffer whenever a reset() is done. This a firmware problem not a web IDE problem. Next step is a git pull request directly on your GitHub repo. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-27 by @gfwilliams Thanks! Best bet is to build with Variables are 16 bytes each and I usually leave 12k for stack/etc, so (96-12)*1024/16 = 5376 for variables. saved_code is to do with page sizes (because on the 401xC chips you have to use the 16kB pages right in the middle of memory). As you have a bigger chip you can afford to just use the 128kB page right at the end of memory, so just delele the whole 'saved_code' section and it should automatically use the last page. Maybe check that it seems to be doing that inside the platform_config.h file that's generated. Honestly I'm not sure about pin names. I'd maybe suggest trying to code in 'AA0..AAx, and AD0..ADx?' it's a bit of a pain though as that's all done with code. And yes, I guess the button is inverted - on the Espruino board it reads 1 when pressed. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-27 by asez73 Thank you! Pin names are a limited problem, I just choosed to use the Espruino's naming convention even for the Arduino's shield connections. This is just an arbitrary choice because finally it complies with the other ST boards and allows for a greater compatibility with Espruino itself. Using the Arduino's pins names would just create complex situations. This is yet to be definitely decided anyway. Any suggestion such as yours will be welcomed: it has to be simple to remember. Did my very very first git pull worked correctly? Congratulation for the Espruino Pico founding, I guess I am one of the super early birds. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-28 by @gfwilliams Thanks for supporting the Pico! Yes, the GitHub pull worked great! You could implement the Arduino pins as |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-30 by asez73 Hello, a- So I have tried to have save() working properly. b- I changed the definition of BTN1 with
No further investigation about it and setWatch() c- The Arduino's connectors pins names will probably end up the an "Arduino." prefix as you suggested. mbed names are totally incompatible with Espruino conventions. Yet, those arduino's connectors pins are just straight connections to the standard Nucleo connectors: I think it could just be aliasing Arduino's names to Espruino's names... So far nothing else, I am focused on save() problem. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-01 by @gfwilliams
So page sizes on F4xx chips go: 16,16,16,16,64,128,128,128 As you have enough flash, you just want to stick code at the end in a single 128kB page (like for the F4DISCOVERY). I think using the py file arrangement from that (Eg, no You can always use peek32 to check if the code is in the correct place after saving it.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-03 by asez73 Hello, About page sizes: Also, I tried the F4DISCOVERY values and did not had success: Apparently, the magic word address was right in the middle of the sector 6 which also contained the saved values. As a side point, you can get: Do you use any of those already? That's all for today... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-03 by @gfwilliams Hi, Thanks for all your work on this! Yep - I use the ID if you look at process.env, although I don't tend to use the flash size as generally Espruino is compiled for a specific size chip. Personally I'd have thought that there should be a single, 128kB page. Actually I seem to recall that there was a hack for the F4 board where I set the flash size at less flash than the board has in order to work around something - which might be the second unlock value (I could be remembering wrong though). I've posted in another thread, but as part of helping me get better chips for the Espruino Pico KickStarter, ST would like me to get the Nucleo 401 working and to put binaries for it on the Espruino website. That means I'll have to sort out the flash/setWatch problems soon anyway - so if you'd rather not spend time on it don't worry too much :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-04 by asez73 Hi, Setting up NUCLEOF401RE.py with my suggested parameters doesn't work yet:
I still have no luck with setWatch: just no reaction to BTN1. Having help from ST is definitely the best thing you could have. Reading the docs shows they have been gradually expanding their variety of products and added some register's tricks incrementally too. As a result, each model of STM32F has its own particularities. So I'll try again but not so often as I expect some clean solutions on your side: You have 15 weeks to solve those things. Don't you? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-05 by @gfwilliams Hi - I don't think it's going to be a problem with the flash writing, as this all works on the F401CC (in the Pico) and the F401VC (in the discovery board), which are going to be almost identical. I'll get a 401 nucleo on order - but for now, you could just set the RAM and Flash size down, and copy the code from https://github.com/espruino/Espruino/blob/master/boards/STM32F401CDISCOVERY.py - that would at least get save working, although you'd just have a bit less memory available. As far as the libraries - I believe these are as up to date as you can get without changing to the STM32 Cube libraries - and doing that is going to require some very serious changes. I haven't encountered any bugs in the libraries for any of the supported chips, so rewriting a bunch of stuff to move to the new libraries is only likely to cause bugs rather than fix them! Hopefully I'll have something working on that board in the next few weeks - as it's almost the same chip as the Pico it shouldn't be too hard. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-06 by asez73 Hi, So, I pushed some changes to NUCLEOF401RE.py that do it for save(). There is no need to update the libraries and yes, I think that would be a lot of rewrites for the substantially little or none benefits. In order to use a lower flash size F4 series you just have to follow my comments in this file. Now I am trying to see how to have setWatch work:
I just pressed and hold down button BTN1 between last 2 digitalRead(C13)... This code was loaded from flash and so the answer when defining setWatch is 'undefined' but actually, it return the integer number that identifies the setWatch for the clearWatch. Arduino's pin renaming is still in progress. There is a parasitic character in the input buffer after a reset(), a save() or a load(). This is not a big issue but still preventing some reloads or reset before programming from the web IDE. Its code is 0xFE or 0xFF. Also, I expect some difficulties with UART6 which I intend to use one day. There is FIXME somewhere is the code about it. Have a nice day and congratulation for the Espruino Pico, you not so far away to get £50000 founding level. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-07 by @gfwilliams Ok, I just got a Nucleo and tested this... I've just added It turns out that |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-07 by @gfwilliams Ok, I take that back - it's not quite that simple :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-07 by @gfwilliams Phew, nope - it was that simple. SYSCFG registers weren't powered up, so weren't taking the values that were being put into them. If you pull from GitHub it should be fixed now. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-07 by asez73 Congratulations: Now BTN1 and setWatch do work!!!
The remaining problems are now:
Just a complement about Nucleo boards:
B- power supplied from USB port: there is the negotiation between the host and the Nucleo that happens at boot time. If there is no agreement from the host, the Nucleo will only use 100 mA from the USB port. This happens when the Nucleo is powered from an USB power supply. The jumper JP1 determines that (manual UM1724 page 17/54). This could also be a trap when more power is required at boot time or later. C- various default solder bridges change a lot of details around the pins potential usage. Again thank you for supporting an "unofficial board". |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-13 by ac413 I can confirm this also works for the STM32f411RE! the 411 has 100mhz and 128 kb sram, so it is a bit more powerful. Making a few changes would be better, but the stm32f401re.bin file does work with the slightly more powerful 411 MCU. The st link software is not as happy when programming; it disconnects and sends an error after. But it does work, and connects to the IDE with no problems. So I am happy! Thanks asez73! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-14 by asez73 Hi ac413, So it worth to note that you should rebuild the .bin from the github deposit. I changed a few lines that makes it work very correctly now for the Nucleo-401RE. If you can test, I will push to my github the required files for the NucleoF411RE. To build your own .bin you need to launch a terminal from ubuntu and type:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-14 by asez73 Hello again, Looking at ST.com, I found that there are 2 others boards that could accept Espruino: However those boards won't have as much computational power as the F4x1RE boards and their pinouts/memory size, general IO functionnalities will be also fairly different. For instance the Nucleo-F152RE has :
So, it could become a whole set of boards. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-14 by @gfwilliams @AC413 thanks for the update! I honestly wasn't expecting that - a friend had tried to compile something for the 411 and it had failed :( |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-14 by asez73 Now, we have a bin file dedicated to the Nucleo-F411RE board. Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-17 by ac413 Tested. I works well! The st-link programming error is gone. Blink code works and saves correctly. Now the 2 best Nucleo boards are supported. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-23 by Manxome Hi! Is the f411 'Officially' supported yet/almost? I am brand new to most stuff here and just downloaded 1v71 and saw the f401 bin, but not the f411... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-23 by asez73 Hello @manxome, Well, the decision is 'officially' supporting a non Espruino board is quite clear: No! Now, I, definitely, can test and debug Espruino embedded in a Nucleo-F401RE board, since, I own one, and do intend to make a useful application out of it. Have a look at the joined file, 2 posts ahead of yours. The goal of ST was to produce pin/pin replaceable MCUs. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-24 by Manxome OK, I used the wrong word, mea culpa :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-24 by @gfwilliams At some point I will put the F411 on that page (if the binary is working properly). Until it's working well I probably won't though - it'll just mean that people get the board, expect Espruino to work, and then come to the forum :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-24 by Manxome Got it! Thanks. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-10-16 by ac413
I think you should offer a premium version of the Espruino IDE for $4.99 on the chrome store. This premium version would have support for the STM32 Nucleo and Discovery series boards with 256k or more. I would like support for the stm32F401RE specifically, but many of them would work well with Espruino.
I would buy the espruino, but I would need to solder some female headers on, and I would need to re-write code to work with my Arduino shields. This way way you get some money, and I don't need to buy another board when I already have 10 similar boards. I would also work on this for free if you wanted to give me some guidance on how to get other hardware to be compatible with the Espruino IDE.
Beta Was this translation helpful? Give feedback.
All reactions