Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: Armmite - STM32H7: Developments Post ReplyPost New Topic
<< Prev Page of 3 Next >>
Author
Message << Prev Topic | Next Topic >>
goc30
Regular Member
Regular Member
Avatar

Joined: 12 April 2017
Location: France
Online Status: Offline
Posts: 62
Posted: 14 June 2018 at 7:32am | IP Logged Quote goc30

matherp wrote:

works perfectly for me


sorry, I misspoke, it is not a functional problem but only in the document excel, where signal "d2" is not registered


Back to Top View goc30's Profile Search for other posts by goc30
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2500
Posted: 14 June 2018 at 9:34am | IP Logged Quote TassyJim

goc30 wrote:

just a small point: signal (arduino) "D2" seem to be lost. In package's doc, pin "d2" is the PF15 pin (n 55)

Thanks for that, there might/will be a few more errors.

Peter,
I have ordered a suitable SD card module but it will take a few weeks to arrive. It won't stop me playing with the other features.

You might be in the height of summer but I am about to take delivery of a little bit of sunshine here.

Electronics might get put on the back burner for a while.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2500
Posted: 14 June 2018 at 3:48pm | IP Logged Quote TassyJim

TONE works from the command line but I am having problems when it is in a program.

There should be a tone when the blue button is pressed.
Quote:
'nucleo tests
SETPIN 7, DIN ' pushbutton 1 (Blue)
SETPIN 137, DOUT ' blue LED
SETPIN 75, DOUT ' red LED
SETPIN 46, DOUT ' green LED
DO
IF PIN(7) = 1 THEN

x =
1 - x
PIN(137) = x
PIN(75) = 1 - x
PULSE 46, 50
PRINT "tone"
PLAY TONE 1000,2000,200
PRINT "Tone OFF"
PAUSE 200
ENDIF
'PRINT x
PAUSE 100
LOOP


The program locks up and I have to RESET to recover.

Jim


__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2115
Posted: 14 June 2018 at 7:10pm | IP Logged Quote matherp

Jim

Many thanks for all your testing. I'll try and diagnose the problem with TONE in programs. Should be able to post SSD1963 support soon.
Back to Top View matherp's Profile Search for other posts by matherp
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2115
Posted: 14 June 2018 at 10:12pm | IP Logged Quote matherp

Version 5.04.09

2018-06-15_062752_Armmite.zip



I have tested this version with Jim's program above and it works fine for me but I haven't made any specific changes in that area. It is worth doing a complete chip erase when loading new versions.

This version now supports SSD1963 displays

Valid displays are:
8-bit RGB888: SSD1963_4, SSD1963_5, SSD1963_5A, SSD1963_7, SSD1963_7A, SSD1963_8
16-bit RGB565: SSD1963_4_16, SSD1963_5_16, SSD1963_5A_16, SSD1963_7_16, SSD1963_7A_16, SSD1963_8_16

The command to initialise the display is

OPTION LCDPANEL SSD1963xxx, orientation


No other parameters are required.

You should set the display to use 1963_PWM for the backlight and then the "BACKLIGHT" command will work

Connections are:
DB0-DB15 on the display connect to PE0 to PE15 on the Nucleo (only DB0-DB7 to PE0-PE7 are needed for 8-bit modes)

SSD-WR to PG10
SSD-RS to PG11
SSD-RESET to PG12
SSD-RD to PG13 (Note this is mandatory)

Remember to connect SSD-CS to GND

NB: the firmware captures all 16 PORT-E pins irrespective of whether 8 or 16-bit communication is used. This simplifies and speeds up the code. Trying to use any of the PORT-E pins when the TFT is enabled will give the error:

Quote:
Error: Pin n is reserved on startup


The picture above is of a 5" display. Note I am having to use an external power supply for the display as the Nucleo was showing an over current warning (LD5) when powering the 5" display direct.

Performance is good. Displaying the 800x480 image takes less than 1 second. CLS in 16-bit mode takes 53mSec.

All displays support transparent text and BLIT. GUI commands appear to work but aren't tested, however as touch is not yet implemented they are of little use. "SAVE IMAGE filename$" works as expected and saves the screen contents as a .BMP file

UPDATE:

Console mode is now also supported.



Also SETPIN CIN, PER, and FIN should work

Pins are PF0, PF1, PF2, PF3 (10, 11, 12, 13)

and IR may work but completely untested

IR pin is PF4 (pin 14)






Edited by matherp on 15 June 2018 at 6:28am
Back to Top View matherp's Profile Search for other posts by matherp
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2500
Posted: 15 June 2018 at 7:59am | IP Logged Quote TassyJim

TONE works for me now with the latest update.
I did take your advice and do a full erase before updating.

I like the speed of updating - much faster than the PIC chips.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
goc30
Regular Member
Regular Member
Avatar

Joined: 12 April 2017
Location: France
Online Status: Offline
Posts: 62
Posted: 15 June 2018 at 10:52am | IP Logged Quote goc30

matherp wrote:
Version 5.04.09



Very very good job, thanks

just somes questions:

1 - with this version, mmbasic say that is "v5.04.10"

2 - I have a 5" LCD, but with sd card. I have seen that you disable spi5-sdcard and use 4bits-sd. Can i use spi1 (arduino D10/D13) for my SdCard on lcd?

3 - maybe it's too early, I need to use COM1 and COM2. on what pin this signals will be connected?, and is it possible to have interrupt functions (the best is to have rec and emit interruptions calls (not only rec as in pic-mmbasic)



Edited by goc30 on 15 June 2018 at 10:53am
Back to Top View goc30's Profile Search for other posts by goc30
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2115
Posted: 15 June 2018 at 5:33pm | IP Logged Quote matherp

Quote:
1 - with this version, mmbasic say that is "v5.04.10"


Yes I updated it when I included the console functionality

Quote:
2 - I have a 5" LCD, but with sd card. I have seen that you disable spi5-sdcard and use 4bits-sd. Can i use spi1 (arduino D10/D13) for my SdCard on lcd?


No - sorry. Testing showed the SPI driver was too slow to be usable for things like picture load and sound

Quote:
3 - maybe it's too early, I need to use COM1 and COM2. on what pin this signals will be connected?, and is it possible to have interrupt functions (the best is to have rec and emit interruptions calls (not only rec as in pic-mmbasic)


Can't be certain on pins yet but com ports should be fairly soon. pic-mmbasic does use interrupts for both TX and RX for coms except com2 on MM2 which is bitbanged. Armmite will use interrupts for all coms. Console already uses interrupts for TX and RX.

I am looking at a PCB design that will interface the Nucleo to a SSD1963 screen and has a SD card on it. Suggestions for other facilities welcome.
Back to Top View matherp's Profile Search for other posts by matherp
 
goc30
Regular Member
Regular Member
Avatar

Joined: 12 April 2017
Location: France
Online Status: Offline
Posts: 62
Posted: 16 June 2018 at 7:47am | IP Logged Quote goc30

matherp wrote:


No - sorry. Testing showed the SPI driver was too slow to be usable for things like picture load and sound

ok

Quote:
Can't be certain on pins yet but com ports should be fairly soon. pic-mmbasic does use interrupts for both TX and RX for coms except com2 on MM2 which is bitbanged. Armmite will use interrupts for all coms. Console already uses interrupts for TX and RX.

ok i wait

Quote:
I am looking at a PCB design that will interface the Nucleo to a SSD1963 screen and has a SD card on it. Suggestions for other facilities welcome.

good idea
for me, i like to have i2c/i2s connectors
Back to Top View goc30's Profile Search for other posts by goc30
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2115
Posted: 17 June 2018 at 12:54am | IP Logged Quote matherp

Please find attached V5.4.11

2018-06-17_020552_Armmite.zip



This release implements touch and 3 separate SPI channels. GUI functionality is tested and appears to work properly. VAR SAVE, VAR RESTORE and VAR CLEAR also now work. NB space available for save variables is 128Kbyte.
OPTION BAUDRATE and OPTION PIN now also working.

Pin usage is as follows:
// SPI pin numbers
SPI_INP_PIN         42 //PA6
SPI_OUT_PIN         43 //PA7
SPI_CLK_PIN         126// PG11

// SPI2 pin numbers
SPI2_INP_PIN        28 //PA2
SPI2_OUT_PIN        27 //PC1
SPI2_CLK_PIN        69 //PB10

// SPI3 pin numbers
SPI3_CLK_PIN        133 //PB3
SPI3_INP_PIN        134 //PB4
SPI3_OUT_PIN        48  //PB2

// TOUCH pin numbers
TOUCH_CLK_PIN        19  //PF7
TOUCH_INP_PIN        20  //PF8
TOUCH_OUT_PIN        21  //PF9


Functionality is the same as the Micromite with the following exceptions:

Three SPI channels
SPI
SPI2
SPI3

Normal syntax except that bit length can be anything from 4 to 32 (not just 8,16,32)

Baudrate input is unlimited but the software will choose the best fit out of 256Kbs, 512Kbs, 1Mbs, 2Mbs, 4Mbs, 8Mbs, 16Mbs, 32Mbs

The touch SPI channel is dedicated to touch and (later) SPI displays and does not impact the other SPI channels.

All pins can be used for digital I/O when SPI and/or touch is not enabled

I used "OPTION TOUCH 114,115" for the test ( PD0, PD1)

Note the pin allocated to the SSD1963 RS pin has changed to pin 57 - RG1

Edited by matherp on 17 June 2018 at 2:06am
Back to Top View matherp's Profile Search for other posts by matherp
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2115
Posted: 17 June 2018 at 10:01pm | IP Logged Quote matherp

Please find attached V5.4.12

This implements I2C and a RTC

2018-06-17_213858_Armmite.zip




The RTC uses the STM32H7 internal RTC which is wired with a 32KHz crystal on the Nucleo PCB. As delivered the clock battery connection is direct to VCC. However, this can be disconnected by removing the zero ohm resistor at SB156 on the back of the board. Then connect a 3 volt battery between VBAT and GND. The VBAT pin is on the outer row near to the Arduino A3 pin. Connecting VBAT means that an external RTC chip is completely unnecessary.
You can see in the picture the small battery I am using and the rough location of the connections.The software is written to automatically load the time from the clock when it powers up or is reset. The clock can be set using the normal.

RTC SETTIME year, month, day, hour, minute, second {,day_of_week}


Note the new optional "day_of_week" parameter this can be set between 1 and 7 for Monday to Sunday. The day of week can be interrogated with a new function "DAY$" this will return the one of "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" as applicable.

You can re-load the Micromite internal time from the RTC at any time by using

RTC GETTIME


I2C commands are as per the Micromite except that the I2C pins are dedicated and not available for other use

Pins are (see picture for rough location)

I2C_SCL           69 //PB10
I2C_SDA           70 //PB11


You should use the normal "I2C OPEN" command to set up the speed of the port and the timeout.

NB valid speeds are limited to 100, 400, and 1000. Other speeds will be rejected.

I've tested I2C with a BMP180 using the attached program which works perfectly without any change from running on the MM2.

OPTION EXPLICIT
OPTION DEFAULT FLOAT
const i2caddr=&b1110111
const MS7=7 'set default wait period
const signed=1
const unsigned=0
'
dim i2cin$ length 8 'max size for integer conversion
dim UT%,UP%
dim ac1%,ac2%,ac3,ac4%,ac5%,ac6%,b1%,b2%,mb%,mc%,md% 'bmp180 parameters
dim x1%,x2%,b5%,b6%,x3,b3%,b4%,b7%,OSS%
dim temperature%,pressure%
DIM altitude,QNH,pressureinHpa
dim OSSdata%(4)
dim OSSscale%(4)
I2C OPEN 400,1000
init:
  OSS%=1 'set oversampling ratio
' OSS%=0 ' Uncomment this line to check algorithm against datasheet
  OSSdata%(0)=&H34 'commands to sample pressure% with different levels of oversampling
  OSSdata%(1)=&H74
  OSSdata%(2)=&Hb4
  OSSdata%(3)=&HF4
  OSSscale%(0)=1 'scale factors for calcs when oversampled
  OSSscale%(1)=2
  OSSscale%(2)=4
  OSSscale%(3)=8
'
  I2C WRITE i2caddr,1,1,&HAA 'send read calibration data command
  I2C READ i2caddr,0,22,i2cin$() 'read in calibration data
  ac1%=intconv(mid$(i2cin$,1,2),signed)
  ac2%=intconv(mid$(i2cin$,3,2),signed)
  ac3=intconv(mid$(i2cin$,5,2),signed)
  ac4%=intconv(mid$(i2cin$,7,2),unsigned)
  ac5%=intconv(mid$(i2cin$,9,2),unsigned)
  ac6%=intconv(mid$(i2cin$,11,2),unsigned)
  b1%=intconv(mid$(i2cin$,13,2),signed)
  b2%=intconv(mid$(i2cin$,15,2),signed)
  mb%=intconv(mid$(i2cin$,17,2),signed)
  mc%=intconv(mid$(i2cin$,19,2),signed)
  md%=intconv(right$(i2cin$,2),signed)
'
' Uncomment this block to check algorithm against datasheet
'
'  ac1%=408
'  ac2%=-72
'  AC3=-14383
'  ac4%=32741
'  ac5%=32757
'  ac6%=23153
'  b1%=6190
'  b2%=4
'  mb%=-32768
'  mc%=-8711
'  md%=2868

main:
  I2C WRITE i2caddr,0,2,&HF4,&H2E 'send temp conversion
  pause MS7 'wait for temperature% conversion
  I2C WRITE i2caddr,1,1,&HF6 'send read data
  I2C READ i2caddr,0,2,i2cin$() 'read 2 bytes
  UT%=intconv(i2cin$,unsigned)
'  UT%=27898 ' Uncomment this line to check algorithm against datasheet
  I2C WRITE i2caddr,0,2,&HF4,ossdata%(oss%) 'send pressure% conversion
  pause (oss%+1)*ms7 'wait for the p  ressure% conversion
  I2C WRITE i2caddr,1,1,&HF6 'send read data
  I2C READ i2caddr,0,3,i2cin$() 'read 3 bytes
  UP%=intconv(i2cin$,unsigned)
  UP%=UP%>>(8-oss%) 'scale the oUT%pUT% by the numb%er of unused bits in the xlsb byte
'  UP%=23843' Uncomment this line to check algorithm against datasheet
  calc_temp
  calc_pressure
  pressureinHpa=pressure%/100
  print "Temperature = ",str$(temperature%/10,4,1),"Deg C"
  print "Local pressure = ",str$(pressure%/100,4,1),"Hectopascal/mb"
  inpUT "QNH in Hpa/Mb  ? ",QNH
  altitude=calcaltitude(QNH,pressureinHpa)
  print "Current altitude in feet = ",altitude
  print "Reverse calculate Sea level pressure = ",calcQNH(altitude,pressureinHpa),"Hectopascal/mb"
end
'
' calc_temperature%: calculate the temperature% from the raw temperature% given the calibration parameters
'
sub calc_temp:
  x1%=(UT%-ac6%)*ac5%\powerof2(15)
  x2%=mc%*powerof2(11)/(x1%+md%) 'This needs to be a floating divide to match the datasheet
  b5%=x1%+x2%  
  temperature%=(b5%+8)\powerof2(4)
end sub
'
' calc_pressure: calculate the pressure% from the raw pressure% given the calibration parameters and temperature% oUT%pUT%
'
sub calc_pressure
   b6%=b5%-4000
   x1%=(b2%*(b6%*b6%/powerof2(12)))\powerof2(11)
   x2%=ac2%*b6%\powerof2(11)
   x3=x1%+x2%
   b3%=(((ac1%*4+x3)*ossscale%(oss%))+2)\4
   x1%=AC3*b6%\POWEROF2(13)
   x2%=(b1%*(b6%*b6%/POWEROF2(12)))\POWEROF2(16)
   x3=((x1%+x2%)+2)\4
   b4%=ac4%*(abs(x3+32768))\powerof2(15)
   b7%=abs(UP%-b3%)*(50000\ossscale%(oss%))
   pressure%=(b7%*2)\b4%
   x1%=(pressure%\powerof2(8))*(pressure%\powerof2(8))
   x1%=(x1%*3038)\powerof2(16)
   x2%=(-7357*pressure%)\powerof2(16)
   pressure%=pressure%+(x1%+x2%+3791)\powerof2(4)
   end sub
'
FUNCTION calcQNH(currentaltitude,localpressure)
  calcQNH=(localpressure*100)/((1-(currentaltitude*0.3048/44330))^5.255)/100
end function
'
function log10(x)
  log10=log(x)/2.302585093
end function
'
function calcaltitude(sealevelpressure, localpressure)
  local a as float, b as float
  calcaltitude=((10^(log10(localpressure/sealevelpressure)/5.2558797))-1)/-6.8755856  *1000000
end function

Function intconv(s$, p%) as integer
 local integer l,k,j,i=len(s$)
 k=peek(varaddr j)
 for l=1 to i
  poke byte k+i-l,asc(mid$(s$,l,1))
 next l
 if p% then
 if (asc(left$(s$,1)) and &H80) then
    for l=i to 7
      poke byte k+l,&HFF
     next l 
 endif
 endif
 intconv=j
End Function 

Function powerof2(i as integer) as integer 
powerof2=(1<<i)
End Function


Edited by matherp on 17 June 2018 at 10:19pm
Back to Top View matherp's Profile Search for other posts by matherp
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2115
Posted: 20 June 2018 at 6:47pm | IP Logged Quote matherp

Please find attached V5.4.13

2018-06-20_193606_Armmite.zip

This implements ILI9341, ILI9481, ST7735, ILI9163, ILI9431-parallel and user Basic displays. MMX sprite functionality is fully implemented. See
the video for my example program running.
See the MMX manual for details of the commands.

ILI9481, ILI9341, ILI9341_16 and SSD1963_4_16 are now implemented using an in-memory buffer which does not affect the 498K available for the user. This allows all sprite, blit and transparent text functionality to work on these displays extremely efficiently.


An additional option is implemented

OPTION FLASHPAGES n


n can be between 1 and 4. This sets the number of 128K segments of flash available for the user program. Default is 4 (512K) but reducing this improves speed for loading programs and executing NEW commands. With FLASHPAGES set to 1 the MEMORY command will show 256K (128K for the program and 128K for saved variable usage)




Demo code:

2018-06-20_192320_apple.zip

option explicit
option default none
const leftbar = 1, rightbar = 2, topbar=3, bottombar=4, rightapple=5, leftapple=6
dim integer moveright=1, movedown=1
box 200,50,10,172,,rgb(magenta),rgb(magenta)
box 20,20,150,10,,rgb(cyan),rgb(cyan)
blit read leftbar,200,50,10,172
sprite copy leftbar, rightbar, 1 'make one copy
blit read topbar,20,20,150,10
sprite copy topbar, bottombar, 1 'make one copy
load sprite rightapple,"apple"
sprite copy rightapple,leftapple,1 'make one copy
load image "tiger480"

sprite interrupt collision
blit show rightapple,250,100,0
blit show leftapple,50,100,0,2
blit show leftbar,199,50,1
blit show rightbar,460,50,1
blit SHOW topbar,20,20,2
blit SHOW bottombar,20,240,2

do
  if moveright then
    sprite scrollr 199,50,262,172,5,0
  else
    sprite scrollr 199,50,262,172,-5,0
  endif
  if movedown then
    sprite scrollr 20,19,150,222,0,-5
  else
    sprite scrollr 20,19,150,222,0,5
  endif
loop
'
'
sub collision
  local integer i, c(10), j
  if sprite(S) = 0 then 'collisions caused by scroll
    j=sprite(c,0)
    for i=1 to j 'store the collisions because a clearing scroll move will clear them from the list
      c(i)=sprite(C,0,i)
    next i
    for i=1 to j 'now process them
      process_collision(c(j))
    next i
  endif
end sub
' get details of the specific collisions for a given sprite
sub process_collision(S as integer)
  select case S
    case leftbar
      sprite scrollr 199,50,262,172,5,0 'make a move to clear the collision
      sprite show rightapple,sprite(x,rightapple),sprite(y,rightapple),0,0  'mirror the sprite
      moveright=1
    case rightbar
      sprite scrollr 199,50,262,172,-5,0 'make a move to clear the collision
      sprite show rightapple,sprite(x,rightapple),sprite(y,rightapple),0,1 'mirror the sprite
      moveright=0
    case topbar
      sprite scrollr 20,19,150,222,0,-5 'make a move to clear the collision
      sprite show leftapple,sprite(x,leftapple),sprite(y,leftapple),0,3 'invert the sprite
      movedown=1
    case bottombar
                      sprite scrollr 20,19,150,222,0,5 'make a move to clear the collision
      sprite show leftapple,sprite(x,leftapple),sprite(y,leftapple),0,0 'invert the sprite
      movedown=0
    case else
  end select
end sub



Edited by matherp on 20 June 2018 at 7:36pm
Back to Top View matherp's Profile Search for other posts by matherp
 


<< Prev Page of 3 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1250 seconds.
Privacy Policy     Process times : 0, 0.02, 0, 0.11