STM32F1 (Standard Peripheral Library ) Why stm32 work failed if not define USE_FULL_ASSERT - assert

Im not good in english, so I'm sorry for my english fisrt, please be patient !
I'm working with stm32f103 and USART2 with RX interrupt. 36 bytes of data are sent continuously every 20ms, If there is no data received via USART then the chip works fine, and if the data is received, the chip is suspended somewhere.
But if I add #define USE_FULL_ASSERT then the chip works fine.
Can someone explain to me?

Related

How do I create new tasks TI RTOS?

I've been trying to develope an APP for the CC2650 from TI. Im working with the SimpleBLEperipheral example.
What I want to do is:
read a UART (up to 80 byte length)
Write the message to a characteristic
The messages come once a second. Here is, where the problem begins:
When I send a request to the device, that is connected via UART, I get a short answer, that is mixed with the messages, that are secondly sent.
In my App I read the UART once a second in the SimpleBLEPeripheral_performPeriodicTask of the example.
The answers, that come in between the messages will not be read, because of timing problems. My idea was to create a task only for reading the UART and use a callback, but that doesnt seem to work. When I create another task, the App doesnt work at all. No task gets called and the device doesnt advertise.
HELP!

Resetting frozen I2C bus using dev adapter

I am using an kontron embedded computer to to communicate to an ST micro controller over I2C. I'm using the dev adapter to interface with the I2C, using the simple read() and write() functions described here.
The problem is if the slave fails to acknowledge a byte for whatever reason, the I2C bus freezes and the master can't send or receive any info (even if the programme is closed and restarted!). The only way I can at the moment reset the I2C bus is by rebooting, which is far from ideal.
Does anyone have any suggestions of what I could do? Is there a way of comunicating over I2C using other methods which can gracefully deal with the communication failing without freezinng? Or any way in which the I2C can be reset?
Recent kernels support I2C recovery at driver level (see 5f9296ba21b3) and this recovery should be triggered automatically. You might have to implement the recovery methods for your kernel and/or add the required definitions of the scl/sda gpios to the devicetree.
The most common I2C bus error is slave device that have ended up in a state where "Data Line" is low. To recover bus, the master device should generate clock till "Data Line" goes high.

Data sheet for chip does not state how to communicate with it

So to start off I am definitely not a Computer Engineer, but I am trying to learn. I found a couple of (93C46CB3) chips along with some other insignifcant chips in a bag, thanks Dad! I studied the data sheet and I figured out which pins do what on the chip, but I have yet to figure out how to read and write to it. It says it's serial but it does not say what baud rate it is. Also, it does not say how fast I should be turning on and off the pins. Does it use PWM? If so, how fast? The data sheet is here
http://www.datasheetspdf.com/datasheet/93C46CB3.html
PG. 7 is where the chart is for reading and writing but it does not say how long those intervals are. "S" "D" and "Q" are all pins btw.
I am trying to read and write its content using an Arduino, and or a Raspberry Pi, whichever works I just need it to work. Thanks in advance!
tldr; How fast do I turn my pins on and off for this chip, and what is the baud rate on this if it has serial communication?
The manufacturer has application notes on the wiring and protocol for their 93 Series Microwire devices
http://ww1.microchip.com/downloads/en/AppNotes/01004a.pdf
http://ww1.microchip.com/downloads/en/AppNotes/01020B.pdf
http://ww1.microchip.com/downloads/en/AppNotes/01029A.pdf
http://ww1.microchip.com/downloads/en/AppNotes/00993a.pdf
and the source in C for PIC microcontrollers is in:
http://ww1.microchip.com/downloads/en/AppNotes/AN1004.zip
TLDR:
Supports SPI or Microwire protocols
The speed for your chip is stated in the datasheet to have a clock frequency of 3MHz but I would recommend 2MHz as that covers all chips in this series.
The most significant bit is sent first
Clock polarity is type 0 (positive)
Clock phase is type 0 (rising edge)
Arduino init example:
SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
This will work with pin 2 connected to SCK, pin 3 connected to MOSI, and pin 4 connected to MISO.
Seems like your chip is actually a 93C46, the CB probably stands for some chip options.
datasheet 93C46 Microchip
This chip is manufactured by many manufacturer, so you may try to find out which manufacturer to get the particular manufacturer datasheet to be sure there is no differences, even there should not be.
If this is true, it's a serial EEPROM which is basically a non-volatile memory. This chip is just a simple memory you can write and read to, but does not contain anything else so you cannot "program" it.
This chip communicate using a SPI bus (Serial peripheral bus) which has one clock line, and two data lines. The chip is a slave, passive component and you need a microcontroller to communicate with it.
I suggest you do further reading on the SPI bus and then on microcontrollers, then you'll be able to write and read its memory.
Serial Peripheral Bus

Using GPIO input instead of TDO/DI on the FTDI 2232H Mini-Module

I’m using the FTDI 2232H Mini Module as a module for a system I’m working on. I’m attempting to read data serially from a device using the FTDI’s GPIOs instead of the TDO/DI pin (MPSSE mode). So, for example, my idea of it would be to perhaps connect a GPIO input to the device’s output, and at each SCLK that the FTDI sends, check whether the GPIO input is high or low. By doing this I would be able to store these highs or lows as 1s or 0s, respectively, into a buffer.
Is it possible to do this, or something similar with the FTDI?
Is there a way to keep count of SCLK pulses or rising/falling edges?
I'm using C++ on a Windows environment.
Thanks
What you are describing is using bit banging which FTDI chips support
including FT232H.
This is the technology I use for my device Nusbio and all the bit banging
computation is written in C#.
Here some source executing SPI bit banging to read data from an EEPROM.
EEPROM/SPI/EEPROM_25AAXXX_BASE.cs
Bit banging is good for chip like the FT232RL or FT231X.
But if you have an FT232H, you can do better.
To answer you question the key is know what is the communication
protocol used by the device your are trying to read data from.
If the protocol is SPI, I2C, JTAG or Serial Port then you should use the native
mode supported by the FT232H.
As mentioned it is called mpsse, Multi-Protocol Synchronous Serial Engine
to simplify synchronous serial protocol (USB to JTAG, I2C, SPI (MASTER) or bit-bang)
design.
If your device support some exoteric protocol with a CLOCK wire which you mentioned, you might have to write your own bit banging.
Is there a way to keep count of SCLK pulses or rising/falling edges?
The Windows PC moslt likely would considered the master so your program is in charge of clocking HIGH and LOW and keeping track of it.
I2C Bit banging Adafruit 16x9 LED Matrix with Nusbio
mpsse SPI with the FT232H and OLED 128x64 display

where is the Serial.println() defined ..? can i see source code for it?

im just looking for how to send/ write date to pc over serial port from arduino..vice versa.
I have few Question to ask after taking so much time and couldn't figure it out myself.
I hope you guys can guid me please.
First, i found i can use Serial.println() function to send some data then, on the pc side, it just checks and reads the port (/dev/tty..).
But, how does this process actually work under the hood? So, if you use serial.println() it knows about where to write?
Second i also found it's something to do with UART communication.. But, inside Hardware.cpp file, i couldn't find any function call to the one for UART.
Third there is the code like extern HardwareSerial Serial;
Then where is the definition of this Serial?
Fourth There seem to have ring buffer for serial buffer. So, when data is being sent then, what and who fill the data into this buffer inside Hardware.cpp?
please, forgive my silly question.. i'm just so curious about this..
As you know to compile the sketch you have o select your Arduino Board and a COM Port where it is plugged in. So from there the Board knows where to send the data. External to the USB port you have for exmaple on the mega with the digital pins 0 and 1. So one of this pins is for transmitting data (TX) and one is for receving data (RX).
2 and3) Yes it has something to do with UART namely with the RX and TX wires I wrote above.
The USB port definitions are in my case here:
C:\Program Files (x86)\Arduino\hardware\arduino\firmwares\atmegaxxu2
The print definitios are here:
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino
and there are some library files where probably the class definitions for the UART is
4) for exmaple you call Serial.println("blabla"); the text "blabla" is pushed char by char into a ring buffer. if he board sends the text o the Serial Monitor on the PC than i empties its content respectively sends it content over the USB cable to the Terminal program (Serial Monitor). If you recevie data then again you fill up an ring buffer (Receive ring buffer)
For further information, I recommend you to read:
http://arduino.cc/de/Reference/Serial