2018-01-06 09:29 AM
Hello am working on STM32L476RG development Board i am trying to develop a smart watch as part of my masters academic project when trying to import the code from mbed complier the code is compiled but it is not being dumped may I know the reason for it
Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-01-07 11:24 PM
You have to compile it from the sources (assure that you have the development version of the libusb installed);
2018-01-07 11:39 PM
The following pieces are easy to port to HAL using CubeMX code generator and adding simple function to call transmit/receive operations or drive a led:
DigitalOut myled(LED1); //displays I2C wait
I2C i2c(PA_10,PA_9);// Serial1_RX=PA_10;Serial1_TX=PA_9
I2C i2cx(PB_9,PB_8);//I2C1_SDA=PB9;I2C1_SCL=PB_8
Serial pc(USBTX,USBRX); //serial usb config
These two have are quite popular references in the Internet. I used to use SSD1306 many times:
Adafruit_SSD1306_I2c myOled(i2c,NC,0x78,64,128);
MLX90614 IR_thermometer(&i2cx);2018-01-07 11:48 PM
Sir Can you please help me out in coding for the MAX30100,MLX90614 and OLED display the purpose is need to read the value for MLX90614 and MAX30100 and display it on OLED display(SSD1306)
2018-01-08 12:08 AM
As I wrote earlier you need to generate STM32CubeMX HAL project skeleton )if you decide to use HAL or LL drivers) for GPIO, I2C, and uart. It's quite easy (enable required resource - watch out pin assignments especially for I2C because by default the CubeMX will assign other pins than those marked for SCL/SDA on nucleo board).
Add basic function for UART Transmit and send a few char to see if the PC UART sees the chars. Do the same for I2c but in this case you need I2C slave device.
Cube will add the following line to your code (I do not mention variable declaration and other staff) - just to show the idea:
MX_GPIO_Init();
MX_USART2_UART_Init(); MX_I2C1_Init();In your program you will need to add these kind of functions to play with UART:
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000);
HAL_UART_Receive(&huart2,(uint8_t *)&ch,1,0);
Of course I omitted details like using printf/putchar etc.
For I2C you need at least:
HAL_I2C_Master_Receive(&hi2c1, deviceAddr<<1, &data, 1, 1000)
HAL_I2C_Master_Transmit(&hi2c1, deviceAddress<<1, memoryAddress, 2, 1000)
The above shows simplicity of using UART and I2c in its basic form.
The UART is trivial.
When you want to program I2C you need to know I2c address (notice for STM32 you need to shift left the address as mentioned in the line code above: deviceAddr<<1) and data format.
For OLED display based on ssd1306 you can reuse some code available in the internet - this one is really popular OR read the data sheet and program the device (I used the latter approach for a few OLED displays I have).
2018-01-08 12:10 AM
For GPIO:
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
2018-01-08 12:11 AM
And mentioned lib for oled:
2018-01-08 12:40 AM
Sir after creation of skelton from Cubemx should i import it to keil and write the code
2018-01-08 12:44 AM