Does the STM32 on the Espruino support UART with 7bit length? #3434
Replies: 10 comments
-
Posted at 2013-10-10 by @gfwilliams I know as much as you about this - but if it's possible in the STM32 then it shouldn't be a big deal to implement in Espruino. I did a quick google and found the following - it looks like if you're happy with 2 stop bits then you can bodge it, but otherwise you can't do it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by Ganehag The need for 7bits comes from the IEC61107 specification. I was trying to port some code to read data from an Ultraheat 2WR5 energy meter into JS. As far as I remember, the standard it uses 2 stop bits. So the hack mentioned in the forum might be possible. I will make some minor modifications to the UARTinfo struct to add support for mode selection. If it work as expected I will do a pull request. Any preferences from you Gordon? char[4] with content like "7e2", "8n1", "8e1" etc? Or should we ignore mode select from mainline? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by @gfwilliams Great, let me know how it goes! How about Maybe just add the following in jshardware:
does that sound ok? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by Ganehag Sounds good. I will implement it and try it out in the next couple of days. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by @gfwilliams Thanks! It'd be awesome if you could contribute it back when it's done - Espruino could really do with a bit more control of its peripherals. Could you also check it compiles on ESPRUINO_1V1=1 ? :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by Ganehag But of course :-). Another thing I was playing around with was menuconfig support for the build environment. Is this something you are interested in Gordon? Like the menuconfig system used for the Linux kernel. It would be nice to have an easy way to configure the build environment and what to include in your own build. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by @gfwilliams Thanks! As far as build goes, if the build could be completely based on boards/XXX.py, that would be awesome. I think it's probably more useful than menuconfig as there's a lot of duplication at the moment between the Makefile and the py file. Of course if menuconfig was just a kind of 'where's your compiler', 'what board do you want to build for' - that could be pretty handy... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by @gfwilliams Even better would be 'you don't seem to have an ARM compiler, would you like me to install one?' :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-11 by Ganehag I've got it working on an STM32VLDiscovery board. Having a hard time to decide if we should handle
To handle |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-11 by @gfwilliams Great! It's probably best to handle it in C (the less people writing in JS have to be aware of the better). Perhaps you could do something like |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-10 by Ganehag
Both
USART_WordLength_8b
andUSART_WordLength_9b
are defined in the header files. ButUSART_WordLength_7b
is not. And sinceUSART_WordLength_8b
begins at 0x0 I suspect that the MCU does not support 7bit UART mode.Beta Was this translation helpful? Give feedback.
All reactions