Blank display if S1820 probe enabled

I am new to mbed. I started by importing the lcddemo for my 746g-disco board.
The lcd demo builds fine and display works.

After adding DS1820 libraries, if I add the line: DS1820 probe(PI_2); the display is blank.
Comment out this line and the text is displayed.

#include "mbed.h"
#include "stm32746g_discovery_lcd.h"
#include "DS1820.h"
DS1820 probe(PI_2);

Hi there,

It looks like the code is stuck in the constructor or something similar.
Can you share a link to an example program or library of the DS1820 what you use?
Did you check the serial output of the crash report?

BR, Jan

of course, now published at

When you read the serial output of the board, you will see this crash

++ MbedOS Error Info ++
Error Status: 0x80FF0100 Code: 256 Module: 255
Error Message: Fatal Run-time error
Location: 0x8005BCF
Error Value: 0x0
For more info, visit: mbedos-error
– MbedOS Error Info –
No unassigned DS1820 found!

The last line is the reason and a rootcause is probably a bad timing or pins setting.

  • When you check the pull-requests of that lib, you will found, for example this one, which is already fixed.
  • Second option is change the DS1820 lib to this DS1820 library , which also has better support by owner for now.

BR, Jan

1 Like

Still no display with the new DS1820 library.

I added the swo lib to add some debug printing. Now I can see the programs keeps running and is printing messages in the swv console. With no sensors connected yet I see the line saying so being printed in the swv.
Then I see the expected “start display” line being spit out. So far everything is ok.
But still no display.

To get the display working I have to comment out the Enumerating sensors code.
I get a strong feeling the onewire lib is conflicting with the lcd hardware.

I can confirm abnormal reaction. I made an investigation and code bellow is working but I have no Idea what is the reason.

#include "mbed.h"
#include "stm32746g_discovery_lcd.h"
#include "DS1820.h"

#define     SENSORS_COUNT   64

OneWire     oneWire(D8);
DS1820*     ds1820[SENSORS_COUNT];
int         sensors_found;      // counts the actually found DS1820 sensors
float       temp = 0;
int         result = 0;

int main()
{
    printf("Starting\n");

    for(sensors_found = 0; sensors_found < SENSORS_COUNT; sensors_found++) {
        ds1820[sensors_found] = new DS1820(&oneWire);
        if(!ds1820[sensors_found]->begin()) {
            delete ds1820[sensors_found];
            break;
        }
    }
    
    if (sensors_found == 0) {
        printf("No DS1820 sensor found!\r\n");
    } else {
        printf("Found %d sensors.\r\n", sensors_found);
        printf("-------------------\r\n");
        HAL_Delay(500);
        char buffer[20]= {0};
       
        BSP_LCD_Init();
        BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
        BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
        BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
        BSP_LCD_Clear(LCD_COLOR_PETROL);
        BSP_LCD_SetBackColor(LCD_COLOR_PETROL);
        BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
        BSP_LCD_DisplayStringAt(0, 1, (uint8_t *)"MBED Robin", CENTER_MODE);
        BSP_LCD_SetTextColor(LCD_COLOR_YELLOW);
        BSP_LCD_DisplayStringAt(0, 100, (uint8_t *)"DISCOVERY STM32F746NG", CENTER_MODE);

       
        while(1) {    
            for(int i = 0; i < sensors_found; i++) {
                ds1820[i]->startConversion();      // start temperature conversion from analog to digital
                HAL_Delay(500); // let DS1820s complete the temperature conversion
                if(ds1820[i]->isPresent()){
                    temp = ds1820[i]->read();
                    //printf("temp[%d] = %3.1f%cC\n", i, ds1820[i]->read(), 176); 
                    sprintf (buffer, "temp[%d] = %3.1fC", i, ds1820[i]->read());
                    BSP_LCD_DisplayStringAt(20, 175, (uint8_t *)buffer, LEFT_MODE);  
                } 
            }  
        }
    }
}

When I tried some changes of this, the display show nothing or the screen slowly disappear with a noise.

  • For some reason it is necessary to use HAL_Delay(ms); instead of wait(s); or for the current version of Mbed thread_sleep_for(ms);
  • When you place an oneWire communication between the Init() + first setting of the display and the while loop, also it will not working and so on.
  • I checked the pin map and it looks like these pins (A0, A1, D8, D12) are free.

BR, Jan

You are probably right in that wait_ms is not compatible with mbed threading.
And I know I will need parralleel treads for my final project.
So I replaced all ‘wait_ms()’ for thread_sleep_for(ms) in ds1820.ccp
Also replaced the HAL_Delay in main. Better keep with one system.

I added rendering the display once before the sensor enumeration also, just to see what happens.
Still no display though.

But look at the output in my SWV:

2020-04-15_15-19-02

These output errors are rare, but the do exist.
Maybe be something going wrong with timing are thread scheduling?

By the way, while I had the situation where the displayed image slowly turns into noise,
Most of the builds, including this latest one, the display is simply blank.

At this moment I am moving from the online compiler to PlatformIO in Visual Code.
In parallel I will create a project here using the MaximInterface libary, to see how that turns out.

It seems the problem is not any DS1820 library but about the BSP library is not friendly with Mbed’s delay functions/methods (thread_sleep_for(ms); ThisThread::sleep_for(ms);) and the HAL_Delay(ms); must be used. Maybe someone clever could explain this to us.
However you can try to import this example DISCO-F746NG_OneWire .

BR, Jan