![]() |
Forum Index : Microcontroller and PC projects : Armmite L4 battery miser, first beta
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10212 |
![]() |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2932 |
![]() What technology are you using for this? FRAM by any chance? Or is it using built-in memory? This is getting very exciting now ![]() |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10212 |
SPI flash - Winbond 25Q32 (4Mbyte), will also support 25Q64 (8Mbyte), and 25Q128 (16 Mbyte) |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
I have given up on stand alone for now. I need to tidy up the bench to give it a better chance. One problem I found while experimenting. SETTICK doesn't work well with PAUSE. The system will lockup and need a reset to recover. Output: Jim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
The STM32L431-LQFP48 would be my choice. I probably could manage to solder it but Element14 don't stock that configuration. 48 pinners have the advantage of Vbat being available. Jim VK7JH MMedit |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 982 |
Frank, here is the code using the bar graph for battery level. ' File L4TEST.V11 ' Program to test Nokia 5110 LCD on ARMmite L4 ' Option LCDPanel N5110,L,11,10,9 set on command line SetPin 13,AIN 'Voltage reading of Vin SetPin 29,DOUT 'Supply 3V3 to DS18B20 Pin(29)=1 Dim T$, D$, I, Tmp, V Dim MaxVolts=6.5 Dim BatSegs=8 CLS Box 0,0,83,48 Do If T$ <> Time$ Then T$=Time$ D$=Date$ V= Pin(13)*11.0 'resistor divider 100K/10K between Vin and GND Tmp=TEMPR(22) Text 10,1,T$ Text 2,12,D$ Text 3,23,"Temp" Text 37,23,Str$(Tmp,2,1," ") Text 70,23,"C" Text 3,34,"Bat" For I = 1 To BatSegs If I*MaxVolts/BatSegs < V Then Box 27+I*6,36,5,9,,,1 Else Box 27+I*6,36,5,9 End If Next I End If Loop OA47 |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 946 |
Hi OA47, thanks for sharing! ![]() I still have problems with your original code. If I understand it correctly, should the time be updated every second? ...with me it is only updated every 2-3 seconds... Why? ![]() Frank |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3350 |
That's the case for me also. I assumed it was because of the overhead which running the code entails. Slightly better for me if I set "CPU 80" first. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10212 |
There are a number of issues with this code. First TEMPR takes about 250mSec and is blocking. Much better to use TEMPR START and then read the value once the expected time has expired. See the MM2 manual. Second, every output to the screen requires that area of the screen to be updated. Use OPTION AUTOREFRESH OFF then do all the screen updates - these then just happen to memory. Once all the updates are complete call "REFRESH" and the physical screen will be updated in an optimised way. I haven't got a test environment with me but try: ' File L4TEST.V12 ' Program to test Nokia 5110 LCD on ARMmite L4 ' Option LCDPanel N5110,L,11,10,9 set on command line SetPin 13,AIN 'Voltage reading of Vin SetPin 29,DOUT 'Supply 3V3 to DS18B20 Pin(29)=1 Dim T$, D$, I, Tmp, V Dim MaxVolts=6.5 Dim BatSegs=8 CLS Box 0,0,83,48 OPTION AUTOREFRESH OFF TEMPR START 22 Do If T$ <> Time$ Then T$=Time$ D$=Date$ V= Pin(13)*11.0 'resistor divider 100K/10K between Vin and GND Tmp=TEMPR(22) TEMPR START 22 Text 10,1,T$ Text 2,12,D$ Text 3,23,"Temp" Text 37,23,Str$(Tmp,2,1," ") Text 70,23,"C" Text 3,34,"Bat" For I = 1 To BatSegs If I*MaxVolts/BatSegs < V Then Box 27+I*6,36,5,9,,,1 Else Box 27+I*6,36,5,9 End If Next I REFRESH End If Loop |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 982 |
Peter thankyou for your refinements. Originally I did have issues with the clock not updating each second but I had: Do T$=Time$ If T$ <> Time$ Then Instead of: Do If T$ <> Time$ Then T$=Time$ I received my 2.9" e-Paper display yesterday and after many hours did not have any success with it until I started to go back in builds. I could get some action back with version 35 but all sorts of problems showed up with 37 including an unstable editor. I will hopefully get time over the weekend to investigate and report back. OA47 |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
I agree. The SPI2-CLK does strange things. It sends a burst at the correct speed. It then sits low for a long time then goes high and stays there. I think the data line is doing something similar. Using the code supplied by Peter. Jim VK7JH MMedit |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10212 |
Because there are so many displays now supported I made the whole system table driven and missed a field in the table which put the whole thing out of kilter Hope this is now OK. I haven't got a display with me to test 2018-11-23_183657_ArmmiteL4.zip struct Displays { char name [14]; int speed; int horizontal; int vertical; int bits; unsigned char buffered; int CPOL; int CPHASE; }; #define FLASH_SPI_SPEED 20000000 #define LCD_SPI_SPEED 25000000 // the speed of the SPI bus when talking to an SPI LCD display controller #define TOUCH_SPI_SPEED 1000000 #define NOKIA_SPI_SPEED 4000000 #define EINK_SPI_SPEED 400000 #define ST7920_SPI_SPEED 1200000 const struct Displays display_details[11]={ {"", FLASH_SPI_SPEED, 0, 0, 1, 1, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"SSD1306I2C", 400, 128, 64, 1, 1, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"SSD1306I2C32", 400, 128, 32, 1, 1, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"ILI9341", LCD_SPI_SPEED, 320, 240, 16, 0, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"ILI9163", LCD_SPI_SPEED, 128, 128, 16, 0, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"ST7735", LCD_SPI_SPEED, 160, 128, 16, 0, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"N5110", NOKIA_SPI_SPEED, 84, 48, 1, 1, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"SSD1306SPI", LCD_SPI_SPEED, 128, 64, 1, 1, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"ST7920", ST7920_SPI_SPEED, 128, 64, 1, 1, SPI_POLARITY_HIGH, SPI_PHASE_2EDGE}, {"GDEH029A1", EINK_SPI_SPEED, 128, 296, 1, 1, SPI_POLARITY_LOW, SPI_PHASE_1EDGE}, {"User", 0, 0, 0, 0, 0, 0 ,0} }; |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 982 |
Peter, can confirm that this release works with e-Paper although the landscape/portrait is still reversed. Not sure about the OPTION AUTOREFRESH OFF as it seems to hang the display OA47 |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10212 |
For all the mono displays, landscape and portrait are defined in terms of the displays' hardware geometry. The GDEH029A1 is a 128 x 296 display so 128 across is "landscape". To change this would mean lots of special cases in the code so this is one you will have to learn to live with. |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 982 |
Thanks Peter, That is not a problem for me I can live with that. I was thinking due to the screen printing that it was a 296X128 display. Please keep up the unbelievable work you are doing. OA47 |
||||
disco4now![]() Guru ![]() Joined: 18/12/2014 Location: AustraliaPosts: 1000 |
Hi Peter, I think this version does not include the fix for the lockup with the pause statement that is posted in the Armmite L4: File support thread. When I load it the lockup issue returns. Regards Gerry Latest F4 Latest H7 FotS |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
Finally got my L4 after having it delivered twice when I wasn't home and then having to drive 60Km to retrieve it from their depot. Have it running with an E-Ink display, with a lot of help from OA47....thanks. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10212 |
It does include the fix but something else is wrong. Trying to code without a test environment isn't working so it will be a week before I can properly sort this. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10212 |
Could somebody please test this version on an e-ink display and let me know if it works - thanks 2018-11-24_190421_ArmmiteL4.zip Option LCDpanel GDEH029A1, orientation, CDpin, RSTpin, CEpin, BUSYpin [,fullrefreshinterval] '2.9" E-INK display, fullrefreshinterval defaults to 1, specifies how many fast updates take place before a "screen flash" full update. Too high a number risks permanently polarising the display I think this is OK with the settick issue. I hope ![]() This version also includes RTC calibration OPTION RTC CALIBRATE n n can be between -511 and + 512. n specifies the number of extra clock pulses to be "created" or "removed" every 2^20 real clock pulses. If my maths are correct therefore a change of +/-1 should equate to about 0.0824 seconds per day. This is a permanent option so will stay active unless the chip is reflashed or options are reset but can be changed with a new OPTION command. Option LIST will report the value if it is non-zero. |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 982 |
Peter, I loaded this version onto the L4 with a 2.9" GDEH029A1 and it still gives me a full black screen between the one second updates if FULLREFRESHINTERVAL is left at 1. If I increase the value to 5 the screen updates but gets greyer on each update until black on the fifth update. OA47 |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |