Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 1 month ago. This question has been closed. Reason: Duplicate question
Does the F303K8 support mbed i2c?
I've attempted setting up the Nucleo-F303k8 as an i2c master and when performing a write I do not see anything on the logic analyzer. I've also setup both PB_7 and PB_6 as Digital Outs and toggled them successfully so I do not believe it is a hardware issue.
Does the F303k8 support mbed i2c?
-Sample Code-
- include "mbed.h"
I2C i2c0(I2C_SDA, I2C_SCL);
int main(){
char data[1]; data[0] = 0x55; while(1){ i2c0.write(0x55, data, 1); }
}
Question relating to:
1 Answer
6 years, 1 month ago.
I dont have the F303 available for testing, but do you have pull-up resistors (eg 4k7) installed on the I2C pins?
I'd forgotten to put pull-up resistors on the i2c lines, but even with those installed I'm seeing the same issue.
Looking under targets.json of mbed it does not specify I2C under device_has_add, but the device does support I2C.
"NUCLEO_F303K8": { "inherits": ["FAMILY_STM32"], "supported_form_factors": ["ARDUINO"], "core": "Cortex-M4F", "extra_labels_add": ["STM32F3", "STM32F303x8", "STM32F303K8"], "config": { "clock_source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" } }, "overrides": {"lse_available": 0}, "detect_code": ["0775"], "default_lib": "small", "device_has_add": ["ANALOGOUT", "CAN", "LOWPOWERTIMER", "SERIAL_FC"], "release_versions": ["2"], "device_name": "STM32F303K8" },
posted by 30 Mar 2018
It looks like this device does not support the i2c.write(int data) method. i2c.write(int address, const char *data, int length); works.
posted by Ryan Shumate 17 Apr 2018