Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC plus-5110 LCD-GPS-BMP280-HMC5983

Status
Not open for further replies.
hi C,
Which is correct.?
get_alt:
'Gosub get_neo 'Reads NMEA DATA<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
PORTD.4 = 1 'CHIP SELECT 5110 OFF
WaitMs 10 'Does CS need time to switch? [SHORTEN OR REMOVE THIS LINE]
PORTD.5 = 0 'CHIP SELECT PRESS ON
SPICSOn
SPISend 0x74 'WRITE 0xF4 Control reg addr
Hi E,
To write to an address, 'say' 0xF4 bit 7 needs to be removed leaving 0x74. See attached in RED:

Note, we spoke about 'burst reading'. In the BLUE box, it says that the register address is incremented. I'll have to read it a few times, to follow.
C.
 

Attachments

  • SPI WRITE.jpg
    SPI WRITE.jpg
    260.3 KB · Views: 193
Hi E,
hi C,
Comparing with what you have to do using Oshonsoft Basic to get accurate values for T and P, with a BMP280.cpp file, IMO it will take ages.

Added this CR LF's to this *.cpp, to *.txt so that you can view with a regular Editor.
E
I get the gist of what it's doingo_O
I don't need the T part, so that's saves a bit.
Is it a coincidence that the resulting PRESS readings at the end of the page are very similar to the ones I've reported?
NOTE: I've yet to find out if CS and SDI and SDO and SCK is 3 wire of 4. It's not clear. (To me anyway)
EDIT: Answer: 4 wire
Thanks.
C.
 

Attachments

  • 3 or 4 SPI.jpg
    3 or 4 SPI.jpg
    19.9 KB · Views: 181
Last edited:
hi C,
Comparing with what you have to do using Oshonsoft Basic to get accurate values for T and P, with a BMP280.cpp file, IMO it will take ages.

Added this CR LF's to this *.cpp, to *.txt so that you can view with a regular Editor.
E
Hi E,
Thanks for the .CCP, I can see that there are some values that are needed to calibrate each module.
At the moment, I'm still trying to get uncorrected RAW results from the T and P addresses.

The TEMP appears to be working with the attached program: '18LF4520 200118 1000 PCB TEMP PRESS TEST' but the PRESS doesn't seem to work as expected.

The second program: '18LF4520 200118 1000 PCB INDIVIDUAL TEMP TEST' is to 'see' each of the 3x TMP READouts, so I can check them individually. I can now 'see' each of the 3, and only XLSB is moving. There is no ALT= as expected, but the result from the 3x READings gives TMP= on the 5110 as 550720 'moving' but I know this is faulty reading, as I think it should be something like:504xxx.
C.
 

Attachments

  • 18LF4520 200118 1000 PCB TEMP PRESS TEST.bas
    11.3 KB · Views: 170
  • 18LF4520 200118 1000 PCB INDIVIDUAL TEMP TEST.bas
    11.6 KB · Views: 173
hi C,
Downloaded your files, will look.

Have you considered using a Spread sheet program on your PC, say entering the Correction value formula's for Tempr and Pressure values.?
You could then feed in the Raw values and see if the final TCeg and hPA values are what you expect.

It should be possible to enter the reverse maths in another Spread sheet program to give Raw readings of T and P.

E
 
hi C,
Downloaded your files, will look.

Have you considered using a Spread sheet program on your PC, say entering the Correction value formula's for Tempr and Pressure values.?
You could then feed in the Raw values and see if the final TCeg and hPA values are what you expect.

It should be possible to enter the reverse maths in another Spread sheet program to give Raw readings of T and P.

E
Hi E,
I looked at varous Arduino examples, also the .CCP file, and don't see exactly how it works. There appear to be individual corrections found in the built module addresses also accuracy settings that can be used in the calculation

I'm pretty sure that for RAW READings no calculations are needed at all. See attached. [I only want PRESS reading actually, but as the TEMP appears to give better results, I'm testing that first]

I get the impression that there is something wrong with SPI.

EDIT: Regarding the suspected SPI problem: I think perhaps all of the TEM and PRESS addresses need to be READ at the same time, but not sure
C.
 

Attachments

  • RAW.jpg
    RAW.jpg
    110.8 KB · Views: 187
Last edited:
hi C,
This is the best I can find at the moment, its a SPI code lib for BMP280.

E
 

Attachments

  • cactus_io_BME280_SPI.h
    4.1 KB · Views: 165
  • cactus_io_BME280_SPI.txt
    9.5 KB · Views: 178
hi C,
This is the best I can find at the moment, its a SPI code lib for BMP280.

E
Hi E,
Thanks, I will of course search through them, but they are a bit unreadable to me.

I have been looking at similar files, also altering the recommned Oshonsoft SPI settings, such as timings in between lines, and which order things are READ.

In the last posted programs, I have two separate SPIs. I am now trying all SPI READings in one section.

Is it possible to change the program to separate TEMP and PRESS READings as they go through the program? Instead of 'say' strxlsb = #t_xlsb also strxlsb = #p_xlsb

EDIT:Going to try separating the strxlsb = #t_xlsb also strxlsb = #p_xlsb values in the program.

C.
 
Last edited:
Hi,
Looking at the attachment in #366.
When I get READings from temp_xlsb I get a range of 004 to 968, which doesn't look correct. It should be the top 1/2 of a BYTE.
Another puzzle: If you look at the attachment it says the result is dependant on the pressure resolution, and also says, in a different section that PRESS can be skipped.
C
 
hi C,
The Pressure resolution is set in Reg 0x74 [SPI] Sect 3.2 of the d/s,
You can skip the Pressure.
E
 
hi C,
The Pressure resolution is set in Reg 0x74 [SPI] Sect 3.2 of the d/s,
You can skip the Pressure.
E
Hi E,
Ok, will co.
[Remember, I only need PRESS, but am testing TEMP because it is easier to warm the module, than elevate it]

Would it be a good idea to have a simpler program, only for READing 3x TMP addresses?

Is it true that the use of the MSG1 STRING for transporting DATA down the program is for economy, where only 1x STRING is used instead of a lot of them? Would it be a ok as a test program to use different variable STRING names, so it looks clearer to me?

I have attached a logic analyser to the PCB, to see if I can see what's happening.
C
 
hi C,
The Pressure resolution is set in Reg 0x74 [SPI] Sect 3.2 of the d/s,
You can skip the Pressure.
E
Hi E,
Here's the choices for 0x74 REG that I've tried in the program.

SPICSOn
SPISend 0x74 'WRITE 0xF4 Control reg addr
SPISend 0xe3 '%11100011 T/ON P/OFF 'Normal Mode
'SPISend 0xe1 '%11100001 T/ON P/OFF 'Forced Mode
'SPISend 0xe0 '%11100000 T/ON P/OFF 'Sleep Mode
'SPISend 0x1f '%00011111 T/OFF P/ON 'Normal mode
'SPISend 0x1d '%00011101 T/OFF P/ON 'Forced Mode
'SPISend 0x1c '%00011100 T/OFF P/ON 'Sleep Mode
'SPISend 0x00 'ALL OFF
WaitMs 100 'without this, occasional 524295?? %1000 0000 0000 0111 reading
SPISend r_t_xlsb 'READ ADDR PRESSURE xlsb from BMP280
SPIReceive t_xlsb 'Least sig Byte
SPISend r_t_lsb 'READ ADDR PRESSURE lsb from BMP280 MID
SPIReceive t_lsb 'mid sig Byte
SPISend r_t_msb 'READ ADDR PRESSURE msb from BMP280 MOST
SPIReceive t_msb 'Most sig BYTE
SPISend r_p_xlsb 'READ ADDR PRESSURE xlsb from BMP280
SPIReceive p_xlsb 'Least sig Byte
SPISend r_p_lsb 'READ ADDR PRESSURE lsb from BMP280 MID
SPIReceive p_lsb 'mid sig Byte
SPISend r_p_msb 'READ ADDR PRESSURE msb from BMP280 MOST
SPIReceive p_msb 'Most sig BYTE
SPICSOff




Are we using the same D/S
Here's mine:

C.
 

Attachments

  • Barometer BMP280 bought.pdf
    1.2 MB · Views: 166
Last edited:
Hi E,
How near is this to a program?
i'm trying to avoid the 'msg1' STRING, so I can read it clearer!
First I want to only write the XLSB then add the others once I see it.
C
 

Attachments

  • 18LF4520 210118 0900 PCB TEMP TEST ONLY.bas
    6.1 KB · Views: 177
hi C,
That will make str_t_xlsb the numeric decimal value of t_xlsb
How you plan to view it?
E

str_t_xlsb = #t_xlsb '???????????????????????????????????????????????
 
hi C,
That will make str_t_xlsb the numeric decimal value of t_xlsb
How you plan to view it?
E

str_t_xlsb = #t_xlsb '???????????????????????????????????????????????

Hi E,
On the 5110.
I guess is needs to go through an ascii conversion?
EDIT: I now see it goes through an ascii conversion, so must be something else.
C.
 
Last edited:
hi C,
I use the Hserout function a lot when debugging, use your Terra-term to check any conversion, its quicker and easier than the 5110.
E
 
hi C,
I use the Hserout function a lot when debugging, use your Terra-term to check any conversion, its quicker and easier than the 5110.
E

Hi E,
The penny hadn't dropped that Hserout could be used for Teraterm as well as the SIM, I'll put them back.
Thanks,
C.
 
Hi,
Before trying Hserout, I stumbled about a bit with the program, and got it working
Here:
If set to READ only MSB (TEMP), touching the BMP280 gives a rsulting range of 122 to 127
If set to READ only LSB (TEMP), touching the BMP280 gives a rsulting range of 234 to 547 (possibly going round the clock)
If set to READ onlyXLSB (TEMP), the PCB needs to be placed in a see through sealed container to get the full range of 0 to 15, but gives the impression of being stable

Looking at the XLSB program, note that I shifted the 4x bits left, I hope this is ok.
Also I added a [Call clear()] because I was getting results, with high numbers such as 960, and think it was because the digits were moving right on the 5110, not clearing so making a 60 look like 960.

Next try to add them together to make one number.
EDIT:The MSB results may look wrong, because it was before adding the 'clearing the 5110' line.
C.
 

Attachments

  • 18LF4520 220118 1400 PCB INDIVIDUAL TEMP XLSB SHOWING 0 TO 15.bas
    7.8 KB · Views: 183
Last edited:
hi C,
As I understand the 20 bit value, it is hi byte, mid byte, low byte.... xxxx,xxxx xxxx,xxxx xxxx,0000 lower 4 bits always zero, so a 4 bit right shift is required
E
 
hi C,
As I understand the 20 bit value, it is hi byte, mid byte, low byte.... xxxx,xxxx xxxx,xxxx xxxx,0000 lower 4 bits always zero, so a 4 bit right shift is required
E
Hi E,
I'll check each byte first, and see what the corrections do, then try to join it as you did before. Previously there was a problem, and I'm not sure where it was. it may be that the XLSB byte is not needed.
C.
 
Status
Not open for further replies.

Latest threads

Back
Top