Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:48 06 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Armmite L4 battery miser, first beta

     Page 5 of 8    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10212
Posted: 03:02pm 19 Nov 2018
Copy link to clipboard 
Print this post




Edited by matherp 2018-11-21
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 03:27pm 19 Nov 2018
Copy link to clipboard 
Print this post


What technology are you using for this? FRAM by any chance? Or is it using built-in memory?

This is getting very exciting now Edited by WhiteWizzard 2018-11-21
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10212
Posted: 03:40pm 19 Nov 2018
Copy link to clipboard 
Print this post

  Quote  What technology are you using for this?


SPI flash - Winbond 25Q32 (4Mbyte), will also support 25Q64 (8Mbyte), and 25Q128 (16 Mbyte)

Edited by matherp 2018-11-21
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 12:00am 20 Nov 2018
Copy link to clipboard 
Print this post

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.

  Quote   DIM n
SETPIN D13, DOUT
PIN(D13) = 0

SETTICK 1000, flick

DO
IF n > 50 THEN PAUSE 100
LOOP
END

SUB flick
PULSE D13, 50
n = n +
1
PRINT n
END SUB



Output:
  Quote   48
49
50
51
52
5
ARMmite L4 MMBasic Version 5.04.37
Copyright 2011-2018 Geoff Graham
Copyright 2016-2018 Peter Mather

>


Jim
VK7JH
MMedit
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 02:46am 20 Nov 2018
Copy link to clipboard 
Print this post

  matherp said  
In general, I do not expect the Nucleo to be the basis for real projects. I've got some STM32L432 chips and UFQFPN32 breakouts on order to play with but the final "project" PCB may well use the 48-pin STM32L431 which is easier to solder. The same binary will be able to work on both chips and by maintaining the An, Dn, pin naming code should be portable with zero changes.

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: Australia
Posts: 982
Posted: 12:56am 21 Nov 2018
Copy link to clipboard 
Print this post

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: Germany
Posts: 946
Posted: 09:54am 22 Nov 2018
Copy link to clipboard 
Print this post

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 States
Posts: 3350
Posted: 02:12pm 22 Nov 2018
Copy link to clipboard 
Print this post

  Frank N. Furter said  If I understand it correctly, should the time be updated every second? ...with me it is only updated every 2-3 seconds... Why?


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.
Edited by lizby 2018-11-24
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10212
Posted: 06:25pm 22 Nov 2018
Copy link to clipboard 
Print this post

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: Australia
Posts: 982
Posted: 08:55pm 22 Nov 2018
Copy link to clipboard 
Print this post

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: Australia
Posts: 6269
Posted: 07:28am 23 Nov 2018
Copy link to clipboard 
Print this post

  OA47 said  
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

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 Kingdom
Posts: 10212
Posted: 08:38am 23 Nov 2018
Copy link to clipboard 
Print this post

  Quote  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.


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: Australia
Posts: 982
Posted: 08:59am 23 Nov 2018
Copy link to clipboard 
Print this post

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

OA47Edited by OA47 2018-11-24
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10212
Posted: 09:35am 23 Nov 2018
Copy link to clipboard 
Print this post

  Quote  although the landscape/portrait is still reversed.


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.Edited by matherp 2018-11-24
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 09:42am 23 Nov 2018
Copy link to clipboard 
Print this post

  Quote  so this is one you will have to learn to live with


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.


OA47Edited by OA47 2018-11-24
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1000
Posted: 08:47pm 23 Nov 2018
Copy link to clipboard 
Print this post

Hi Peter,

  matherp said  
Hope this is now OK. I haven't got a display with me to test

2018-11-23_183657_ArmmiteL4.zip


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: Australia
Posts: 1982
Posted: 09:40pm 23 Nov 2018
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 10212
Posted: 10:09pm 23 Nov 2018
Copy link to clipboard 
Print this post

  Quote  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.


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 Kingdom
Posts: 10212
Posted: 09:06am 24 Nov 2018
Copy link to clipboard 
Print this post

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: Australia
Posts: 982
Posted: 09:39am 24 Nov 2018
Copy link to clipboard 
Print this post

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.

OA47Edited by OA47 2018-11-25
 
     Page 5 of 8    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025