I am trying to load a SPI memory module with some images. The process should be:
PC image convertor > Serial > STM32F1 raw write to SPI mem > SPI memory
the problem is that I am waiting for the buffer to get full or at least 256 so I can write the page.
Any ideas on the .available() ? It reports always 0
For now I will try another approach.
I am trying to load a SPI memory module with some images. The process should be:
PC image convertor > Serial > STM32F1 raw write to SPI mem > SPI memory
the problem is that I am waiting for the buffer to get full or at least 256 so I can write the page.
Any ideas on the .available() ? It reports always 0
For now I will try another approach.
not sure how to answer the second question I got the STM32 Arduino from https://github.com/rogerclarkmelbourne/Arduino_STM32
I seems that these are the files used
hardware/Arduino_STM32/STM32F1/cores/maple/HardwareSerial.cpp
hardware/Arduino_STM32/STM32F1/cores/maple/libmaple/usart.c
hardware/Arduino_STM32/STM32F1/system/libmaple/include/libmaple/usart.h
not sure how to answer the second question I got the STM32 Arduino from https://github.com/rogerclarkmelbourne/Arduino_STM32
I seems that these are the files used
hardware/Arduino_STM32/STM32F1/cores/maple/HardwareSerial.cpp
hardware/Arduino_STM32/STM32F1/cores/maple/libmaple/usart.c
hardware/Arduino_STM32/STM32F1/system/libmaple/include/libmaple/usart.h
USB gets detected as Serial in the Arduino env.
Using a blue pill smt32F103C
I am using Serial1 which is PA9 PA10. The test is pretty simple:
setup
Serial1.begin(115200);
loop
while(1){
delay(200);
Serial1.println(Serial1.available());
}
Solution:
1. you read all available bytes from USART and copy them to your own (larger) buffer
or
2. change the Rx buffer size – yo have to look in the source files for that.
If always reports 0, then you have a reception problem. Check the wires.
Alternatively use serial USB, it should work with relative high throughput (around 600kbps for Rx).
The problem is that it is always displaying 0. Tried the same example on an Arduino uno and it works, I upload, then open the serial monitor and see a lot of 0s when I send something the value changes because we now have something in the buffer.
I have the STM32 connected via PA9, PA10 to a USB CP203x this is how I output data (program via USB output via Serial for debug).
The value on the STM32 never changes from 0. It should go up to 64 or the rx buffer size and stay there till read.
Of course, you have to send something to get no-zero number as received bytes count.
Of course, you have to send something to get no-zero number as received bytes count.
Also like I said I am trying to use Serial1 for a raw flash of a spi memory via the mcu with the data coming from pc.
1) one solution is get the spi connected to the Arduino uno and flash the chip via serial
2) the second is build a buffering mechanism to keep track of items as I can only write 256 bytes at a time so I need to buffer the rest
3) or split the “packets” of info into 256 and send one lump at the time….and wait for response back saying it was written
Will try with RX/TX2 and 3 for a quick available() check but it is the same class so there should not be any difference…
<…>
I hate the USB serial as the port gets closed when programming the board and I need to reopen the logging mechanism every time…
<…>
I hate the USB serial as the port gets closed when programming the board and I need to reopen the logging mechanism every time…
And that is why I am not using it…I do not find any value in your joke/comment
Trying Serial2 is a good idea.
Trying Serial2 is a good idea.
But if you have doubts about our advises you better find out the solution alone. I am out of this issue from now on.
But if you have doubts about our advises you better find out the solution alone. I am out of this issue from now on.
void setup() {
Serial.begin(115200);
}
void loop() {
while (1) {
delay(200);
if ( Serial.available() ) {
Serial.println(Serial.read()) ;
}
}
}
it works for ESP, it works for Uno but not for STM32F1X….
I can do it myself in my sketch with some elbow grease …. but I thought it might be worth it to debug the actual cause and fix it in the repo ![]()
it works for ESP, it works for Uno but not for STM32F1X….
mrburnette wrote:
You are aware that the STM32duino core as inherited from Leaflabs has the USB code linked into the sketch code and uploaded into the “sketch” flash storage space?
Ray
This sketch using USB DOES WORK THE SAME AS THE ESP8266 output above! SO, if USB serial is broken, it has happened since July 2016 which was the last time I updated the home /Arduino/hardware/STM32 core folder.
Ray
/*
ArduinoIDE 1.6.13 running on Linux Mint 17.3 with Maple Mini Clone Bootloader 2.0
STM32duino version: 19 July 2016
Sketch uses 13,124 bytes (10%) of program storage space. Maximum is 122,880 bytes.
Global variables use 2,560 bytes of dynamic memory.
*/
void setup() {
Serial.begin(115200);
}
void loop() {
while (1) {
delay(200);
Serial.println(Serial.available());
}
}
But if you have doubts about our advises you better find out the solution alone. I am out of this issue from now on.
Other than that, I have said it many times in other threads, but get a debugger. An stlink clone cost 2 bucks and will save you lots of headaches.
https://www.hackster.io/rayburne/the-qb … tor-ae7015
Ray
I just updated to the last commit and voila all worked as a charm. Lesson learned, update repo before posting stupid questions and wasting people’s time.
Thanks all of you for support.
@mrburnette
@stevestrong
@victor_pv
And a little treat, check the image attached.
it is a STM32, attached I have a 25q 64mbit flash and a ili9486. All raw data is uploaded to flash via a serial from a PHP script that parses gif files and writes a custom TOC 32bytesx128entries and then the actual data for the pictures. All images are stored in a gif like format, pallet-ed images (colors are stored in an array then in another array you only add the index of the pallet color to save space).
Currently I have the memory manager, which reads and writes to the flash, next is a UI manager that will keep track of images by layer so you can redraw only some parts of the screen and not the whole screen.


