N0 pin outputs

Hi, I know i am going to regret asking this question.

I have worked with microchip pic’s for many years and have a good understanding of micro’s and c/c++ code.

But i thought i would learn a bit about the STM32f103c8t6 and the arduino ide.

So i wrote a few lines of code to prduce some output on the port pins.

Starting with i2c.

#include <Wire.h>
#include <SoftWire.h>


#define BNO055_SLAVEADDRESS 0x28

  Wire.beginTransmission(BNO055_SLAVEADDRESS);
  Wire.write(data);
  Wire.endTransmission();

Simple bit of code in a loop produces not pin activity.

Simalar with a small serial output code, no pin output.

All compile and upload ok.

Using FTDI232 and Blue Pill.

I am missing something somewhere.

Any ideas.

(deleted)

Hi,

Yes pull-up resistors fitted.

I have the same issue with RS232 serial, no pin activity, but data appears in serial monitor.

There seems to be something i am missing about activating port pins.

What you posted is not compileable code..

I only showed part of the code. Here is my complete test code.

Nothing appears on the I2C or the serial ports. The digital write does flash the led.

The serial data, appearts on the serial monitor.

Regards

#include <SD.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <Adafruit_BMP280.h>
#include "bno055.h"
#include <arduino.h>
#include <limits.h>
#include <math.h>
#include <Wire.h>
#include <SoftWire.h>
// I2C defines and includes
#define BNO055_SLAVEADDRESS 0x28
#define BMP280_SLAVEADDRESS 0x76
#define GPIO_RS232_TX GPIO_Pin_12
#define GPIO_RS232_RX GPIO_Pin_13
int8_t data = 0x31;

TwoWire Wire1(PB11, PB10);

//TwoWire HWire (2, I2C_FAST_MODE);          //Initiate I2C port 1 at 400kHz.
//HardWire HWire(2, I2C_FAST_MODE);

void setup()
{
  pinMode(PC13, OUTPUT);                      //led 
  Serial.begin(57600);
  Serial1.begin(9600);
  Wire.begin();
}

void loop()
{
  Wire.beginTransmission(BNO055_SLAVEADDRESS);
  Wire.write(data);
  Wire.endTransmission();

  
  int byteSent=Serial.write("fred");
  Serial.write(data);
  Serial.println();

  Serial1.println("This is serial 1");
  digitalWrite(PC13, HIGH);
  delay(100);
  digitalWrite(PC13, LOW);
  delay(100);

}

If you’re new to the STM32F1, try some simpler things first like digital writes to verify the pin assignments. Also which STM core are you using? There are several.

The STM official core has compilation options in the ‘tools’ menu of the IDE that you need to set correctly, in order to make the serial work. It’s not automatic.

  digitalWrite(PC13, HIGH);

Digital I/O Arduino pins don't use names (like 'PC13'). Did you mean Bit 13 on I/O port 'C'? You will have to look up the Arduino pin number for that I/O pin.

Hi I got the pin id PC13 from the simple 'blink' program and that part of my code works.

I have just switched from the FTDI232 dongle to ST-Link and the same problem, no output on any pin, apart from the led.

I also notice that using the ST-Link i can not see the serial monitor in the ide any more..

aarg, i am not sure i understand your comment about what core am i using.

I am using the ST32f103c8t6 on the Blue Pill board.

Any advice appreiated.

horkesley: aarg, i am not sure i understand your comment about what core am i using.

I am using the ST32f103c8t6 on the Blue Pill board.

The "Blue Pill" is not sold by Arduino.cc so it is a third-party board. For third-party boards that are not direct clones of an Arduino board, you have to install a 'core' that supports the processor. For example, if you select "Blue Pill" or similar from Tools->Board then you must have installed a 'core' that supports the processor on that board. That core will define, somewhere, the mapping between processor pins and Arduino pin numbers or names.