hybridfree/eevblog-posts huggingface dataset:
PIC18F26K40 memory access bug - Page 1
Forum section: electronics / general

author: 0b01010011
author_rank: Regular Contributor
timestamp: January 05, 2017, 09:34:15 pm
content: Not sure this is well documented on the web, but I had some fun with the PIC18F26K40 recently - basically anything using/accessing constants, such as a const int, or a const char array (an inline string for example) was not returning the valid content of the constant.I put this down to my primitive embedded skills at first, but it turns out there is a bug in this particular PIC (and the 27K40 according to others) that means without setting some register at powerup, the PIC fails to successfully return values from program memory reads.My experience was with a inline string (which was defined as const char xx[] = "XXX") and with a const int. In my experience the string was full of NULs, and the int was 0, regardless of what the code said.Here is the errata (see section 3):http://ww1.microchip.com/downloads/en/DeviceDoc/80000712A.pdfAnd here is step-by-step way to implement the workaround in MPLABX:http://www.microchip.com/forums/FindPost/957920Apparently this workaround is implemented automatically in XC8 1.40 but I have not tested this. The workaround does work and the PIC behaves fine now.

author: tommy_tom2000
author_rank: Newbie
timestamp: May 27, 2019, 02:05:25 pm
content: Wow I have been been struggling to get my font array working for hours before I found this post. Thanks for the heads up!Can confirm that the workarround works fine.Tommy
Interface LCD display using I2C from a blue pill board (STM32) - Page 1
Forum section: electronics / general

author: larsdenmark
author_rank: Regular Contributor
timestamp: May 20, 2019, 08:19:53 am
content: I wish to interface a 20x4 LCD display to a blue pill board (STM32F103). The LCD display is equipped with an I2C adapter (PCF8574). The idea is that when using this adapter I have to use less IO pins on the blue pill. I'm using the Arduino IDE for programming the blue pill:https://tinyurl.com/yxp44rrzWhen using the LCD display on an Arduino everything works fine. Here I'm using the LiquidCrystal_i2c library. When compiling the library for the blue pill it complains that it isn't compatible with the blue pill and sure enough the program stops in initialization when I try to run it.Any ideas for where to get a library that works or do I have to make my own?

author: obiwanjacobi
author_rank: Super Contributor
timestamp: May 20, 2019, 10:34:33 am
content: My guess is that this should work?No guarantees.[From my ATL lib]https://github.com/obiwanjacobi/atl/blob/master/Source/Code/Arduino%20Libraries/ATL_HD44780/examples/I2CLCD/I2CLCD.ino
the fragile ATMEGA4809XPLAINEDpro - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: May 17, 2019, 06:04:39 pm
content: Is it me or is this dev board designed to self destruct? I'm now on my 4th that having programmed it once with the built in USB it now is invisible to my PC. This is crazy.It's working (my LCD tests) but the USB/PDI chip is a goana! Better get the ICE again!

author: ataradov
author_rank: Super Contributor
timestamp: May 17, 2019, 06:52:50 pm
content: The board includes the same EDBG chip as normal Atmel-ICE. And those things are pretty reliable. They are included on all Xplained boards, so they get a lot of testing. It must be something you are doing, or your PC somehow kills USB devices.Does it blink the LEDs in any special pattern?

author: Simon
author_rank: Unknown
timestamp: May 17, 2019, 06:55:55 pm
content: Just green power. I am sick of these stupid boards, I,ve done nothing to any of them to make them fail. Switching one to the 3.3V supply did it in. It's so stupid.

author: Simon
author_rank: Unknown
timestamp: May 17, 2019, 07:15:25 pm
content: Now the Atmel ICE is not recognised eithor so maybe a problem on the PC but I can't think what.

author: Simon
author_rank: Unknown
timestamp: May 18, 2019, 08:58:15 am
content: Yep, no explained pro board or my ICE are recognised by windows 10. There has been a windows 10 update. Sems to not be the first time someone has windows 10 issues, all the help I can find is to remove atmel studio and drivers and start again.

author: ataradov
author_rank: Super Contributor
timestamp: May 18, 2019, 04:54:57 pm
content: Quote from: Simon on May 18, 2019, 08:58:15 amDo they not appear even in the Device Manager?

author: Simon
author_rank: Unknown
timestamp: May 18, 2019, 05:04:46 pm
content: Nope, i have the same with a USB bluray player which i got replaced but is not at fault it's windows 10 and this is across several machines so it's windows. The disk drive at least makes a noise when plugged in but does not show up in device manager. The dev board and ICE just get powered. nothing else at all.

author: ataradov
author_rank: Super Contributor
timestamp: May 18, 2019, 05:47:12 pm
content: I have not seen anything like that before. I don't even know if reinstall of AS will solve this, but I guess it is something to try.

author: Simon
author_rank: Unknown
timestamp: May 18, 2019, 05:51:04 pm
content: I'll compare it with the work setup on Monday

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 19, 2019, 05:35:52 am
content: Did you ask about this over on avrfreaks ? There are a LOT of users there, who would know about this type of issue.It's not Atmel, but it is Windows + MCU tools related, I saw this issue go past a couple of months back. Maybe Atmel as a similar wrinkle ?https://www.silabs.com/community/mcu/8-bit/forum.topic.html/informational_thread-Cli5

author: Simon
author_rank: Unknown
timestamp: May 19, 2019, 07:04:58 am
content: I'll ask on AVR freaks. i found some old threads about the same issue and the answer had been to uninstall and reinstall AS7 with everything disconnected.
Cortex M, DMA SPI to external RAM - Page 1
Forum section: electronics / general

author: ZeroResistance
author_rank: Frequent Contributor
timestamp: May 24, 2019, 08:00:44 am
content: I have some data streaming in from SPI at 1MB/sec. Is it possible to DMA this data into external RAM? Does the Cortex M4 / M7 range of processor allow for this ?

author: newbrain
author_rank: Super Contributor
timestamp: May 24, 2019, 08:36:31 am
content: If the external memory is controlled through the F(S)MC, it can be the target of a peripheral to memory DMA transfer.

author: mark03
author_rank: Frequent Contributor
timestamp: May 24, 2019, 04:04:23 pm
content: You did not say what sort of interface your external memory has, but yes, probably. Worst case, you might need intermediate ping/pong buffers on the chip between two different DMA, one incoming from the SPI, the other outgoing to your memory. But note that DMA capability is not a property of Cortex M, but rather a peripheral added by the manufacturer (ARM licensee). So ST Micro, NXP, etc. each have their own DMA implementation, and you would need to study the reference manuals carefully to verify the specifics for each processor.

author: ZeroResistance
author_rank: Frequent Contributor
timestamp: May 25, 2019, 06:05:01 am
content: Quote from: mark03 on May 24, 2019, 04:04:23 pmYou are correct, the DMA seems to have 2 ports, 1 memory port and 1 peripheral port.So what you say may be needed to be done.ST block diagram attached.

author: mark03
author_rank: Frequent Contributor
timestamp: May 25, 2019, 11:21:57 pm
content: I think the gist of @newbrain's reply was that if your external RAM is mapped into the MCU's address space, i.e. you read and write to it the same as you would to internal RAM, only at a different address, then the DMA task is a very standard "peripheral to memory" move.

author: Freddie Chopin
author_rank: Regular Contributor
timestamp: May 26, 2019, 06:57:07 am
content: Quote from: mark03 on May 25, 2019, 11:21:57 pmSuch assumption is wrong, because DMA can be considered as a separate CPU core - it has its own bus matrix ports and it may not see all memory address ranges. The key thing is whether the DMA is connected from its both sides to the peripheral and memory you wish to access. This is the thing you can see on the bus matrix picture, as presented 2 posts above.
SDCard 1-BitMode no Command Response  - Page 1
Forum section: electronics / general

author: Snoopy04
author_rank: Contributor
timestamp: May 04, 2019, 02:22:33 pm
content: Hi,for a week I'm trying now to get a SDCard to Respond to a 1-BitMode Command instead of SPI because of the Speed Advantage. The Command Sequence I'm sending in correlation with the Clock Signal looks perfect on the Oscilloscope but No matter what I'm trying there is no Respose on the Command line. If I've understood correctly the Initialisation is exactly the same as SPI but with the CS Signal constantly on HIGH. So After sending a CMD0 I should get a response on the Command line. I've nearly read all Documentaion I've could find on this toppic without success. Does anybody now what I'm doing wrong.

author: Freddie Chopin
author_rank: Regular Contributor
timestamp: May 04, 2019, 06:11:44 pm
content: For some commands there is *NO* response when using the SD/MMC interface. This would also be the first command you are expected to send, which is CMD0 - the card will *NOT* respond to this command in any way. So you need to post some more details - for example whether you try to implement this protocol in software or if you are using a dedicated peripheral.

author: thm_w
author_rank: Super Contributor
timestamp: May 06, 2019, 09:32:42 pm
content: If you have a USB logic analyzer that could help a lot, sigrok has some build in SD decoding. Along with posting screenshots here.Did it work already using SPI mode?I assume you've read the SD Card spec and have seen the card initialization steps tree?

author: Snoopy04
author_rank: Contributor
timestamp: May 10, 2019, 01:33:24 pm
content: @Freddie ChopinAre you sure that this is right? if I'm issuing a CMD0 in SPI Mode I'm getting a R1 Response.I'm trying to implement it in Software. A Harware solution would reqire a new Micro with a complete new Architecture.@thm_wWell I do not have a logic analyse. Yet. Only my trusty DS1054zYes it Did. It worked perfectly. I've already read that but in every Document it's not Clear how exactly I'm getting into SD Mode. For example in the TOSHIBA Datasheet it states the following:QuoteFor SPI step 2 is pretty obvious but what the hell does step 2 for SD mode mean

author: Freddie Chopin
author_rank: Regular Contributor
timestamp: May 10, 2019, 01:40:27 pm
content: Quote from: Snoopy04 on May 10, 2019, 01:33:24 pmYes, I'm sure. in SD mode, there is _NO_ response for CMD0. See Chapter 4.7.4, page 86 in the simplified specification for the SD cards (first download here -https://www.sdcard.org/downloads/pls/). CMD0 is not the only command which has no response in this mode. You can find my driver for SD cards in SD mode here -https://github.com/DISTORTEC/distortos/blob/master/source/devices/memory/SdCard.cpp

author: thm_w
author_rank: Super Contributor
timestamp: May 10, 2019, 09:04:48 pm
content: Quote from: Snoopy04 on May 10, 2019, 01:33:24 pmCD/DAT3 pin is also called CS in spi mode.You leave it driven high to enter normal mode, instead of pulling it low to enter SPI.
Extracting Program from Atmel Device - Page 1
Forum section: electronics / general

author: Sparky49
author_rank: Regular Contributor
timestamp: May 07, 2019, 05:38:11 pm
content: Hi,I've opened a digital pressure meter in the hopes of adding a serial interface for PC logging. When opening the device I noticed that the device (AT89S52http://ww1.microchip.com/downloads/en/devicedoc/doc1919.pdf) already has five headers broken out. These are connected to 9V (battery voltage), GND, 10 (RXD), 11 (TXD) and 13 (interrupt). Seems like a serial interface already exists! However, it just remains at idle - I suspect it is waiting for something on the interrupt, but I would like to examine the code if possible.However, I have no experience with this device, nor with extracting the code from a device. I suspect that it was programmed out of circuit as there are no other connections for programming. in this case, what hardware do I need? What software? I've tried researching, but haven't found any clear information regarding this. I'm a little hesitant to just dive in myself, as I'd prefer to avoid doing something stupid.If some pics would help, I'd be happy to provide. Thanks in advance.

author: Sparky49
author_rank: Regular Contributor
timestamp: May 07, 2019, 06:40:49 pm
content: Thanks for the reply, Blueskull.I think I might have explained things a little incorrectly, I don't think that it was programmed from UART, just that UART connections exist and no other pins do. Maybe it was programmed on another board, and placed into the circuit?That second part is a little disheartening though...I might go to my original plan and try to use another mcu to intercept the data to the lcd and then send that out through a uart.I took some pics for reference, the headers on the top left are for the lcd.

author: Sparky49
author_rank: Regular Contributor
timestamp: May 07, 2019, 07:22:44 pm
content: Thanks again, Blueskull.If that is the best course, I may have to end up doing that. However, I think in the meantime I'll at least attempt to read and decode the data going to the LCD and spit that out over uart from another uC I make myself. Might be a little less hassle, and lower in cost too. Unfortunately it isn't a standard interface I've come across, but that might make it more interesting.

author: magic
author_rank: Super Contributor
timestamp: May 07, 2019, 08:57:05 pm
content: Without decapping, there is a possibility of power/clock glitch attack. I've found vague information on the Internet about successes with Atmel MCUs but no detailed procedures, I'm afraid.It is possible to extract code from factory configured ATmega32U4, although certain fuse settings thwart the attack

author: mikerj
author_rank: Super Contributor
timestamp: May 08, 2019, 05:58:51 pm
content: Have you tried injecting serial data into the RX pin using all the common baud rates and frame configurations?
Rig for programming a PIC - Page 1
Forum section: electronics / general

author: L_Euler
author_rank: Regular Contributor
timestamp: May 06, 2019, 07:25:07 pm
content: I just rescued a PIC16C72A from a garage door opener and want to play around with it. I have it mounted on a SMD to 28-pin wide DIP adaptor board. I see several programming options available that claim to be compatible with the 16C, but they are all serial port based. Is there a USB option (programmer and adaptor/socket board) available that for sure is compatible with the 16C? And preferably <US$100. I assume the current MPLAB will work as an IDE. Microchip's website is less than user friendly.

author: oPossum
author_rank: Super Contributor
timestamp: May 06, 2019, 07:38:03 pm
content: The 16C72 is OTP (one time programmable), so you can't reprogram that salvaged chip.

author: L_Euler
author_rank: Regular Contributor
timestamp: May 06, 2019, 07:46:21 pm
content: That's a handy piece of information. Thanks.

author: jpanhalt
author_rank: Super Contributor
timestamp: May 06, 2019, 09:37:37 pm
content: Does it have a window on top. That may be covered with tape. If so, it is UV erasable and re-programmable once erased. Still a very old chip. Use something modern.

author: mariush
author_rank: Super Contributor
timestamp: May 06, 2019, 09:46:28 pm
content: The Snap programmer is around 15$ :https://www.microchip.com/developmenttools/ProductDetails/PartNO/PG164100It can program pretty much all PICs that don't need high voltage programming, which is pretty much majority of the PICs released in the last years.Digikey:https://www.digikey.com/products/en/development-boards-kits-programmers/programmers-emulators-and-debuggers/799?k=snapFarnell :https://uk.farnell.com/microchip/pg164100/snap-in-ckt-debugger-mcu/dp/2915518?st=microchip%20snapBut like everybody said, that particular PIC can not be reprogrammed... but if you do decide to buy the programmer from one of the sites above, those distributors also stock PIC microcontrollers, so you could spend a few dollars on a bunch of PIC chips... they start from around 0.2-0.5$ for a 6pin micro, here's a list (not all in this list may be supported by that Snap programmer but majority will) :https://www.digikey.com/short/pzb21d
Mecrisp Forth Unofficial Documentation site moved - Page 1
Forum section: electronics / general

author: techman-001
author_rank: Frequent Contributor
timestamp: May 04, 2019, 11:51:46 am
content: G'day to all 42 Forth users out there ;-)I've moved my documentation pages, they now reside at the following URL's.Mecrisp-Stellaris for Cortex-M :https://mecrisp-stellaris-folkdoc.sourceforge.io/Mecrisp-Across tethered MSP430 :https://mecrisp-across-folkdoc.sourceforge.io/
BLACK STM32F4VET6 with Arduino IDE - Page 1
Forum section: electronics / general

author: hussamaldean
author_rank: Unknown
timestamp: May 02, 2019, 06:48:27 pm
content: Hi all,recently, I got myself a new awesome uC which is BLACK STM32F4VET6 to design three phase SPWM inverter (challenge accepted)here is a picture for the uCanyway, I want to upload blink sketch but it turns out the USB is for power only and when I want to connect my FTDI to serial port, PA9and10 no successis there anyway to upload the code ?regards and thx in advance

author: newbrain
author_rank: Super Contributor
timestamp: May 02, 2019, 09:38:15 pm
content: Here's some suggestion to get your board going:If the board has no Arduino style bootloader, you won't be able to load a program through the IDEAll STM32s have an internal bootloader, capable of downloading a binary into the flash. This can be used to burn an Arduino like bootloader.Specifically theSTM32F407 bootloadercan do that from USART1 and 3, CAN bus, or USB (DFU), see chapter 26.The BOOTn pins need to be correctly set up for the bootloader to be activated.For serial, a specificflashermust be run on the PC, and you can use more or less any USB to serial(3.3V levels) converter.An alternative way is using an ST-Link (cheap clones abounds on the usual sites) connected to the SWD pins and the good oldST-Link utility, or the newSTM32CubeProgrammer(which can also flash through serial or USB DFU)Lots of information can be found on theSTM32duino wiki.A note: the USB pins on your board are connected, at least according to theschematic, and there's a quartz for the HSE so it should be capable to use DFU, once the BOOT pins are correctly set (seethe relevantchapter 4 pattern 1 in the bootloader doc linked above: BOOT0 = 1 and BOOT1 = 0) and a suitable DFU utility is running on the PC.I will refrain to comment on the choice to use the Arduino IDE.EtA: links to the programming utilities and BOOT pins configuration.

author: hussamaldean
author_rank: Unknown
timestamp: May 03, 2019, 02:56:46 am
content: Quote from: newbrain on May 02, 2019, 09:38:15 pmI completely forgot about BOOT0 pin and tried to upload directly just like arduinoforce of habitbut now it does work and I blinked the two built in ledsit is a progress
Floating RST and BKGD pins on 'S08 - Page 1
Forum section: electronics / general

author: Circlotron
author_rank: Super Contributor
timestamp: April 29, 2019, 05:32:44 am
content: In the manual the connections from the debug header to the MCU are shown as direct connections. There are no additional caps, etc. With the RST pin though, wouldn't it be likely to pick up noise and cause unintended resets? Would a 100nF cap to ground be suitable? Would that upset entering debug mode? I can't put a cap from BKGD to ground because that would shunt any data flowing there. Also I presume that the pin used for BKGD will not cause trouble during normal operation because nothing else uses it in my application.

author: RES
author_rank: Regular Contributor
timestamp: May 01, 2019, 04:58:12 pm
content: From FAN3335.pdf page 3:The BKGD pin is a pseudo open-drain pin with an on-chip pullup, that is, no external pullup resistor isrequired for noise immunity.
STM8S105C6 TIM2 does not start - Page 1
Forum section: electronics / general

author: Curby
author_rank: Contributor
timestamp: May 04, 2019, 07:38:58 pm
content: Hi,I can only start TIM1. TIM2 does not start. What could be wrong? CLK is enabled. TIM is enabled and the interrupt is monitored in the main loop. The LED on PORTD.0 should blink but in the debugger i can see, the timer is not running.Code:#include "stm8s.h"#include "stm8.h"#include "bool.h"#define F_PER ((uint32_t)2000000)_Bool bVal = false;main(){uint8_t i;static uint16_t u16Counter = 0;PINCONFIG(GPIOD, 0, T_OUTPUT, T_PUSHPULL, T_2MHZ);CLK->PCKENR1 |= CLK_PCKENR1_TIM2;TIM2->PSCR = 5;*(uint16_t*)&TIM2->ARRH = (uint16_t)(F_PER / 32);TIM2->IER = TIM2_IER_UIE;TIM2->CR1 = TIM2_CR1_CEN;//enableInterrupts();while (1){u16Counter = *(uint16_t*)&TIM2->CNTRH;if(TIM2->SR1 & TIM2_SR1_UIF){TIM2->SR1 &= ~TIM2_SR1_UIF;if(bVal){bVal = false;SET(GPIOD, 0);}else{bVal = true;CLR(GPIOD, 0);}}}}
'9S08PA16 inputs D4-D7 unbonded or nonexistent? - Page 1
Forum section: electronics / general

author: Circlotron
author_rank: Super Contributor
timestamp: May 01, 2019, 05:42:29 am
content: So we know that unused port pins should ether be made outputs or tied to ground. On some versions of a '9S08PA16 ports D4-D7 and others don't appear to the outside world on packages with smaller pin counts. Are these ports on the die but unbonded so floating, or do they not actually exist so can be ignored?

author: amyk
author_rank: Super Contributor
timestamp: May 01, 2019, 11:50:16 am
content: You'd have to decap to answer that question, but it's a pretty safe bet that if the pins aren't there on the package then you don't have to worry about them...
Tech Vocabulary - Help me Find the Right Word(s) - Page 1
Forum section: electronics / general

author: kfnight
author_rank: Regular Contributor
timestamp: April 22, 2019, 05:48:35 pm
content: Let's call a bus's clock "free-running" if it is always oscillating even when there is no transmission of data. An example of a free-running clock would be a non-gated PCLK clock in APB. What do we call a clock that only oscillates during transmission of data? An example would be SPI's SCLK.

author: hans
author_rank: Super Contributor
timestamp: April 22, 2019, 05:52:48 pm
content: Suggestion: a gated clockIt's only enabled when needs to be active.

author: Yansi
author_rank: Super Contributor
timestamp: April 22, 2019, 06:25:26 pm
content: Or just a strobe signal

author: RES
author_rank: Regular Contributor
timestamp: April 22, 2019, 06:45:05 pm
content: Serial clock (SCK). Burst.

author: CustomEngineerer
author_rank: Frequent Contributor
timestamp: April 29, 2019, 02:55:00 am
content: Quote from: blueskull on April 22, 2019, 06:08:17 pmNext gen ultra efficiency clock?
Low voltage stepper motor driver - Page 1
Forum section: electronics / general

author: alizare368
author_rank: Regular Contributor
timestamp: April 27, 2019, 03:06:50 pm
content: Hi everyoneI'm working with the stepper motor driver (stspin220).the stspin220 is not hot when the motor is in operation but when the motor does not work,the stspin220 gets very hot.what's the problem?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 28, 2019, 12:39:12 am
content: Mayby your lack of knowledge and/or experience ?
Reference design for Padauk MCUs - Page 1
Forum section: electronics / general

author: notanick
author_rank: Newbie
timestamp: January 04, 2019, 01:29:19 pm
content: There's a greatdiscussiongoing on reverse engineering the programmer for Padauk's microcontrollers. The folks there are making a very impressive progress and I do not wish to interfere in that discussion. So, I'm posting this question separetely.I'm intrigued by the flash products, more specifically, the PFS154 and the PFS173.Does anyone have a schematic for these two in particular or any other of Padauk's MCUs? For the life of me, I'm unable to find anything and I'd like to see how others have sized the power supply bypass caps, protected the power input (which needs to go up to 8V for programming), shared the programming pins with other peripherals, und so weiter.

author: spth
author_rank: Regular Contributor
timestamp: April 23, 2019, 08:33:26 pm
content: I've made a board that supports the PFS154 and the PFS173:https://github.com/free-pdk/f-eval-boardsI've run some C programs (written in C) on them, in particular the LED timer count example (https://github.com/free-pdk/sdcc-pdk-code-examples).

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: April 24, 2019, 05:08:59 am
content: QuoteThanks for sharing, I'm a windows and Altium user, would you please add PDF files to your repo?
Dragino Lora hat on raspberry pi.  - Page 1
Forum section: electronics / general

author: conducteur
author_rank: Regular Contributor
timestamp: April 12, 2019, 11:59:28 am
content: Hello,I have two Dragino Lora Hats (and two raspberry pi's, model 3B)I try to run this example script. I can send (and receive) the data once. After that, the pi that runs the client script becomes completely unresponsive? I have no clue what's causing this. Maybe there are more experienced raspberry pi users here?Thanks!https://github.com/idreamsi/RadioHead/blob/master/examples/raspi/rf95/rf95_client.cpp
Sipeed MaixPy and MaixDuino show case: run AI easier~ - Page 1
Forum section: electronics / general

author: zepan0
author_rank: Contributor
timestamp: April 12, 2019, 07:15:14 am
content: Hi guys, it is the show case post for Sipeed Maix boards, software based on MAixPy(micropython) and MaixDuino(Arduino).Sipeed MAIX boards is based on K210, dual cor RISC-V 64bit IMAC chip, it run at 400MHz, able to turbo to 600MHz, 8MB SRAM inside, MMU worked. KPU inside support neural network accelerate.MaixPy is based on micropython, it is openMV-compatible, support littlevgl, support NN API:https://github.com/sipeed/MaixPyMaixduino is based on Arduino IDE, it is Arduino-compatible (also we have same board shape one), support littlevgl, support NN API:https://github.com/sipeed/MaixduinoIt is show time:basic 3x3 conv accelerate, show simple edge detectionrun MNIST demo with 30lines python code:https://bbs.sipeed.com/t/topic/596mobile net 1000 class object recognition @ 20fps @ 224x224 (max 30fps):yolo face detection in 20lines python:https://bbs.sipeed.com/t/topic/600face recognition demo:feature map display:https://bbs.sipeed.com/t/topic/598Our MAIX module is 1-inch squared:Our smallest develop board is 1x2 inch, breadboard-compatible:MAIX-Bit（$10）And full function board MAIX-GO:The newest Arduino-compatible board: MaixDuino:Here is more video:seeed show openMV functions:(we will release openMV IDE this week)https://www.bilibili.com/video/av48652548Arduino IDE run mobilenet:Arduino run littlevGL:MaixPy run NES:run GBA(via MMU)https://www.bilibili.com/video/av48654358run quake I:https://www.bilibili.com/video/av48656943run FFT:https://www.bilibili.com/video/av44617696microphone array:face tracking PT:MaixPy play baddapple.avi:play MMD at 100fps:https://www.bilibili.com/video/av48656998We are making MaixDuino now.If you are interested in our board and project, and you are the senior arduino fans/developer, We will provide free MaixDuino free to you.If you make cool application for MAIX, we will send free board to you too.welcome show your project in this post.
MPLab X IDE weird message on mac - Page 1
Forum section: electronics / general

author: Moriambar
author_rank: Unknown
timestamp: April 21, 2019, 03:12:49 pm
content: Hi,I recently tried MPLab X IDE 5.15 on my mac.I tried a test project, created from scratch targeting attiny202. I made the compiler xc8 v 2.05.I just have this test codeCode:#include <cstdlib>#include <xc.h>using namespace std;/***/int main(int argc, char** argv) {return 0;}Unfortunately I get an error message which seems to be often put up by the ide when building, ie:Code:make: *** No rule to make target 'build/default/production/newmain.o', needed by 'dist/default/production/test.X.production.hex'. Stop.I tried all suggested by the online docs: creating a new project, checking the permissions on the project folders (which were correct and which I enabled for r/w to everyone) and checking the compiler was present (it is).I currently am stuck and don't know what to do. Perhaps it's just not meant to be. I gave the forum one last shot, though. Can anyone help? Have I perhaps done something wrong?cheers

author: cv007
author_rank: Frequent Contributor
timestamp: April 21, 2019, 03:59:39 pm
content: There is no c++ support for avr when using xc8.

author: Moriambar
author_rank: Unknown
timestamp: April 21, 2019, 04:00:12 pm
content: Quote from: cv007 on April 21, 2019, 03:59:39 pmthanks

author: Moriambar
author_rank: Unknown
timestamp: April 21, 2019, 05:41:25 pm
content: Wait, I installed the AVR toolchain from the microchip website and it does the same thing after switching the compiler...C works fine though

author: cv007
author_rank: Frequent Contributor
timestamp: April 21, 2019, 07:19:47 pm
content: The avr toolchain from Microchip seems to be the same thing as what is already in xc8. You can add the avr compiler (in xc8) to the embedded build tools option by pointing it to the xc8/v2.xx/avr/bin folder, which has the same result (and same version) as adding the downloaded avr toolchain.This compiles for a tiny202 in mplabx with the toolchain added as above.Code:#include <stdint.h>#include <stdbool.h>struct Pins {enum PIN { A0, A1, A2, A3, A6=6, A7 };enum PDIR { INPUT, OUTPUT };Pins(PIN pin, PDIR pdir = INPUT, bool lowison = false): m_pin(pin), m_lowison(lowison){((volatile uint8_t*)VPORTA)[DIRCLR-pdir] = (1<<pin);}bool pinval(PIN pin){return ((volatile uint8_t*)VPORTA) & (1<<m_pin);}void on(bool tf){((volatile uint8_t*)VPORTA )[OUTCLR-(tf xor m_lowison)] = 1<<(m_pin);}private:enum { VPORTA=0x20 };enum { DIR, DIRSET, DIRCLR, DIRTGL,OUT, OUTSET, OUTCLR, OUTTGL,IN };uint8_t m_pin;bool m_lowison;};int main(){Pins led1( Pins::A0, Pins::OUTPUT );led1.on(true);for(;;);}Although you can compile with c++, if you are counting on a lot of c++ support stuff I think its pretty minimal. Maybe there is some other avr gcc compiler somewhere with more c++ support, I don't know.Since this is a small chip, I would be happy with just having the c++ compiler and would doubt there is anything missing of any value that you couldn't simply do yourself.
MikroC PIC program MCP3204 to LCD - Page 1
Forum section: electronics / general

author: edba
author_rank: Contributor
timestamp: April 06, 2019, 09:33:49 pm
content: HiI am trying to write a program that uses the EasyPICv7 and reads from an external ADC (MCP3204). It connects via the MikroBus no. 1 on the board. The connections are exactly the same as ADC click. I have tried to understand the LibStock SDK of the ADC board and can't get my head around it. I have done some assembly code programming of PICs about 15 years ago, so I am a bit rusty. I want to read from any of the channels and display it onto the LCD. I find it is quite hard to learn MikroC and when I got my kit it was hard to find any tutorials to actually learn the board and get confidence. I think this is quite a weakness in Mikroelektronika's product,Edba
[AVR] Buffer overflow leads to MCU reset - by what mechanism does this occur? - Page 1
Forum section: electronics / general

author: HwAoRrDk
author_rank: Super Contributor
timestamp: April 06, 2019, 10:32:53 am
content: Yesterday I encountered and fixed a bug in some AVR code of mine. It was a pretty stupid bug: I neglected to check the number of bytes I was tellingmemset()to operate on. The line of code was as follows:Code:memset(&foo, 0x00, foo_max - foo_len);Fairly straightforward - I wanted to fill the remaining space in an array with zeros. Except, a mistake in a preceding line of code madefoo_lenin certain circumstances have a value one larger thanfoo_max. Whoops, my calculated size value is negative and just got wrapped around into a large positive integer, so I just askedmemset()to write to 65,535 bytes of memory!Unsurprisingly, this did not have positive effects.The AVR microcontroller crashed and reset. What I am curious to learn is by what mechanism the reset occurred.If I had to make an educated guess, I would say that writing zeros to RAM proceeded unimpeded all the way to the end of the address space (2K RAM on the part I'm using, so address 0x08FF according to the datasheet) and then wrapped around to the beginning, where it trampled on the CPU registers, which is what caused the reset. Perhaps because the execution pointer got written to zero, so effectively jumping to the start of program memory?I would be interested to hear whether my guess is correct.

author: tsman
author_rank: Frequent Contributor
timestamp: April 06, 2019, 11:06:41 am
content: You'll have overwritten the stack which is at the end of RAM and grows backwards. The return address is kept there so when it pops that off the stack it'll jump to the reset vector at 0x0000.The PC and SP registers aren't kept in data memory.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: April 06, 2019, 04:09:14 pm
content: Oh, okay, that makes sense. I was thinking writing past the end of RAM would wrap and nobble the stack pointer registers, but if not I guess post-memset()execution returning to location 0x0000 would make it seem like a reset had occurred.

author: cv007
author_rank: Frequent Contributor
timestamp: April 06, 2019, 05:34:21 pm
content: Its been a long time, but the mega88, mega16 act as follows (newer ones act possibly the same)-if using an xyz pointer or lds/sts- if the address is greater than sram end, the resulting address will be in sramexample- mega88 with RAMEND=0x4FF, 11bit addresses (0x7FF)if address > RAMEND then addressH = addressH & 7 - RAMENDHso for address of 0x623, actual address is 0x223 (6 & 7 = 6, 6 - 4 = 2, addressH = 2)stack pointer will act the same, in addition the stack pointer does nothing on a push to an address below sram, and a pop below sram will pop a value of 0if you have a debugger you can verify this (if curious)
Looking for this chip or a compatible alternative - Page 1
Forum section: electronics / general

author: jayjr1105
author_rank: Regular Contributor
timestamp: April 02, 2019, 08:33:05 pm
content: W25Q128FVIt's for a BIOS chip on an Asus motherboard. Friend know's how to program them, just need to find this or a compatible replacement.

author: DC1MC
author_rank: Super Contributor
timestamp: April 02, 2019, 08:40:28 pm
content: Digikey offers not one but two direct substitutes:https://www.digikey.com/product-detail/en/winbond-electronics/W25Q128FVSIG/W25Q128FVSIG-ND/3008697EBAY has TONS of them, but why risk ?Cheers,DC1MC

author: Kilroywashere
author_rank: Regular Contributor
timestamp: April 02, 2019, 08:41:20 pm
content: http://www.bios-chip24.com/Winbond-25Q128FVIQ-128MBit-SPI-Flash-DIP-8-300mil/enFound one i think

author: jayjr1105
author_rank: Regular Contributor
timestamp: April 02, 2019, 09:02:02 pm
content: Quote from: Kilroywashere on April 02, 2019, 08:41:20 pmShouldn't they be like $1? Also, DC1MC, I need through hole.

author: jayjr1105
author_rank: Regular Contributor
timestamp: April 03, 2019, 03:38:50 pm
content: What about the 64 or 32 version of the chip? Not sure if that's words capacity or what.https://www.ebay.com/itm/5PCS-W25Q64FVAIG-25Q64FVAIG-3V-64M-BIT-SERIAL-FLASH-MEMORY-DIP8/292367973180?_trkparms=aid%3D555018%26algo%3DPL.SIM%26ao%3D1%26asc%3D20131003132420%26meid%3D7d5c5b3c70774da9b311b520ed6891fe%26pid%3D100005%26rk%3D1%26rkt%3D12%26sd%3D252547143798%26itm%3D292367973180&_trksid=p2047675.c100005.m1851Like this one
I2C Acknowledge bit Vl53l1x - Page 1
Forum section: electronics / general

author: Twos
author_rank: Newbie
timestamp: April 01, 2019, 11:34:51 am
content: Hi,I am trying to let my STM32L0 communicate with a VL53l1x. The Device adres is 0x52 and i can see it on my scope but the Ack-bit behaves weird.The '1' on the I2C line is 3.3V and the '0' is at 0V. My Ack-bit has a value of 1.88V.I am not sure what to do about this.Thanks

author: mjs
author_rank: Regular Contributor
timestamp: April 01, 2019, 12:03:42 pm
content: How have you implemented I2C on the MCU side ? You can get this kind of result if the MCU and device both try to drive the line instead of MCU releasing the pin.What kind of pull up resistors do you have ?

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 01, 2019, 03:45:05 pm
content: That looks as though either you didn't configure the I/O pins for I2C as open drain, or the pull-up resistors are way too low in value.

author: Twos
author_rank: Newbie
timestamp: April 03, 2019, 10:04:04 am
content: There is a pullup resistor in the sensor module and i had pullup configuered in the MCU. Changed the mode to NOPULL and it fixed the problemThanks.
Error when using vPortFree(ptr) CMSIS-RTOS on STM32F4 - Page 1
Forum section: electronics / general

author: marcelogadotti
author_rank: Newbie
timestamp: April 01, 2019, 02:56:42 pm
content: I will need to handle dynamic memory using malloc and free. Looking on FreeRTOS documentation, I found pvPortMalloc(size) and vPortFree(ptr) , pvPortMalloc(size) works fine. When try to release memory using vPortFree(ptr) inside a Thread, the code hangs on that call.I'm using heap_4 for CMSIS-RTOS on TrueStudio.

author: ehughes
author_rank: Frequent Contributor
timestamp: April 01, 2019, 11:13:34 pm
content: Is the pointer you are freeing NULL? Did you single step to see what is happening? You have the source code so it should be pretty straight forward.Also, I am not sure what the CMSIS layer does with freeRTOS but it is only an API layer. There might be some goofiness going on here. (I would not recommend using an API layer, it is generally a waste).Lastly, what are you FreeRTOS config settings?

author: marcelogadotti
author_rank: Newbie
timestamp: April 02, 2019, 05:20:23 pm
content: I did solve the problem, it happens when increment the pointer and try to free after this operation.
How to find all available SDR / DDR1 SDRAM on aliexpress? - Page 1
Forum section: electronics / general

author: soFPG
author_rank: Frequent Contributor
timestamp: April 02, 2019, 03:31:05 pm
content: My question is already in the title, just to clarify:1. I need external SDR or DDR1 SDRAM for my next project2. I do not care if it comes in TSSOP or BGA (if pitch is not <0.8mm)3. I already looked at mouser but most of the results I get with parametric search are not available on aliexpress (where it is usually cheaper)4. I do not know what SMD SDR / DDR1 chips are available on aliexpress due to no parametric search, therefore I am asking if anyone could share his information if he found a cheap part5. Capacity should be around 64Mb

author: OwO
author_rank: Super Contributor
timestamp: April 02, 2019, 03:57:01 pm
content: Search for "sdram" and click the "Integrated Circuits" category on the left.
ATSAMS70 Inconsistent USB connection - Page 1
Forum section: electronics / general

author: MBarker
author_rank: Newbie
timestamp: April 02, 2019, 03:46:31 am
content: We are using an ATSAMS70N21B on a PCB that we designed and had built. We are trying to connect the board to a USB 3.1 memory stick and run the USB in high speed mode. However, we are having trouble getting the USB to work consistently. One time we’ll run the code and it will work fine then another time we run the same code and the microcontroller doesn’t connect to the USB. We used a similar code on a SAM E70 Xplained development board and it worked fine. The code and the errors we are getting are given below. Are there any suggestions on code/libraries that we should look at modifying to get the USB to work consistently?We are using the ASF 3.40 version on atmel studio. The library used for accessing the usb is the usb host mass storage and for opening/reading the files is fatfs.int main(void){#if SAMD21 || SAML21//system_init();#elsesysclk_init();board_init();#endifirq_initialize_vectors();cpu_irq_enable();// Initialize the sleep managersleepmgr_init();ui_init();// Start USB host stackuhc_start();while (main_usb_sof_counter <= 2000) {}main_usb_sof_counter = 0;volatile uint8_t lun;FRESULT res;// Mount drivememset(&fs, 0, sizeof(FATFS));res = f_mount(lun, &fs);////This command occasionally returnsFR_INVALID_DRIVEif (FR_INVALID_DRIVE == res) {// LUN is not presentlun_states = TEST_NO_PRESENT;continue;}// Create a test file on the disktest_file_name = lun + '0';res = f_open(&file_object,(char const *)test_file_name,FA_CREATE_ALWAYS | FA_WRITE);////This returns FR_NOT_READY ORFR_DISK_ERRORif (res == FR_NOT_READY) {// LUN not readylun_states = TEST_NO_PRESENT;f_close(&file_object);continue;}if (res != FR_OK) {// LUN test errorlun_states = TEST_ERROR;f_close(&file_object);continue;}f_close(&file_object);}When the power is reset on the device the above program usually behaves in three different ways:1) It works at times ,executes all the statements ,returns FR_OK and creates a text file on the usb2) It returns FR_OK for f_mount but returns FR_not_ready for f_open statement or at times it just skips the statement3) It returns FR_INVALID_DRIVE after the F_mount statement is executed and then it just skips the rest of the program. When this happens, the LUN obtained is usually a random number.Whenever 2 or 3 happens STA_NOINT is not cleared in the disk_initialize statement which needs to be cleared for the drive to be initialized.

author: ataradov
author_rank: Super Contributor
timestamp: April 02, 2019, 04:39:26 am
content: I don't think you can avoid debugging this thing and actually tracing what causes those error codes.If I remember correctly, there are some issues with debouncing, so if this error only happens when you insert the drive while device is already running, then it might be it. If it happens even after reset when the drive is already connected, then it is something else.
Attiny x5 family: unclear datasheet or me just a beginner? - Page 1
Forum section: electronics / general

author: Moriambar
author_rank: Unknown
timestamp: April 01, 2019, 09:52:53 am
content: Hi.I've been tinkering quite a bit with the ATTiny x5 family (mostly the 25V), but just lately I've started to fully understand its datasheet (you know: learn by doing).Anyhow, while browsing thedatasheet, specifically on page 9, I have problems regarding the status register flags, specifically:What does the half carry flag represent?for reference the datasheet says to look to the "Instruction set description" but I don't find it in the datasheet. Where am I wrong?Perhaps I need more base knowledge (especially for the half carry), if you think so, do you know of any resources (videos or books) which could help me?Thanks

author: up8051
author_rank: Frequent Contributor
timestamp: April 01, 2019, 10:12:26 am
content: http://ww1.microchip.com/downloads/en/devicedoc/atmel-0856-avr-instruction-set-manual.pdf

author: Moriambar
author_rank: Unknown
timestamp: April 01, 2019, 10:46:03 am
content: Quote from: up8051 on April 01, 2019, 10:12:26 amoh,this one!Cheers.
ADC measurement - Amplitude of Pulse Width in PIC uC - Page 1
Forum section: electronics / general

author: arul
author_rank: Regular Contributor
timestamp: March 30, 2019, 01:05:11 pm
content: Hi All,I want to measure the amplitude of the given input pulse using ADC of PIC18F57K42 microcontroller.The period time of the pulse is 1ms (1kHz). The pulse width can be varied from 1us to 1000us.The sampling frequency of the ADC is 1391.3043kHz. The conversion time of ADC is 718.75ns.I read the ADC in 50 times. After that I took one of the ADC value for ADC conversion. Because sometimes some noise will be present. So i took one the best ADC value using in the manner of ascending order, mode method.If I put 100us pulse width and more mean, I got a near by ADC value. But below that pulse width of 100us mean, i didn't get the ADC value within 50 times reading of ADC. But my task is to measure amplitude of the pulse width starts from 1us onwards. Right now I got ADC value of 1us pulse width above 1000 times of ADC reading. How will I measure the amplitude of pulse width 1us within 50 times of ADC reading?Advance in thanks...

author: NorthGuy
author_rank: Super Contributor
timestamp: March 30, 2019, 01:24:28 pm
content: What is the nature of the pulse? If you only want pulse width, may be it's a good idea to digitize it with a comparator instead of ADC?

author: arul
author_rank: Regular Contributor
timestamp: March 30, 2019, 01:39:34 pm
content: Thank you #NorthGuy...I want to measure the amplitude of the pulse width, like 100mV to 5V not pulse width... The time period is 1000us. But the pulse width (ON time) will be varying from 1us to 1000us.

author: NorthGuy
author_rank: Super Contributor
timestamp: March 30, 2019, 02:05:40 pm
content: Quote from: arul on March 30, 2019, 01:39:34 pmI see. You have square pulses and need to measure amplitude of them.Then you need to sample continuously. You need to come up with some sort of criteria which tells you if you're currently within the pulse or outside it. While within the pulse, you collect the data (say sum them up to get an average). As soon as you move out of the pulse, you calculate the final value (say by dividing the accumulated sum by the number of samples you had while within the pulse).Your PIC's minimum TAD (from the datasheet) is 1 us. You need at least 2 TAD for sampling - 2 us. There's no way you can catch 1us pulse with this, yet alone measure the amplitude. You need a faster ADC.

author: mikerj
author_rank: Super Contributor
timestamp: March 30, 2019, 09:52:56 pm
content: Consider using a peak detector circuit to hold the peak value until it is converted, and then reset the peak detector.

author: David Hess
author_rank: Super Contributor
timestamp: March 31, 2019, 02:50:25 am
content: Fast discrete analog peak detectors are that fast. It is actually easier to measure the area under the peak using a fast integrator.
Calculation mismatch in C - Page 1
Forum section: electronics / general

author: arul
author_rank: Regular Contributor
timestamp: March 30, 2019, 02:13:28 pm
content: Hi All,I have trouble with calculation mismatch. The following is the program .////data type declaration//////unsigned int edge1, edge2, edge3, ED21, ED31;float freq1, freq2;double prt, pulse, PRT,PULSE;#define timer_freq 16000000void main(){if(edge2 > edge1){ED21 = edge2 - edge1;freq1 = (float) timer_freq / (float) ED21;pulse = (double) (1000000 / freq1) ;}if(edge3 > edge2){ED31 = edge3 - edge1;freq2 = (float) timer_freq / (float) ED31; ////(float) (float)prt = (double) (1000000 / freq2) ;}}The output of the program:(using UART)ED21: +8002.00freq1: +1999.50pulse: +500.124ED31: +16005.0freq2: +999.687prt: +1000.31(The above is correct calculation)ED21: +8002.00freq1: +1999.50pulse: +3595.56ED31: +16005.0freq2: +999.687prt: +1000.31(The above is wrong calculation)The above calculation values are changing depends on the value of ED21, ED31. But the value of ED21 & ED31 are same. But the calculation gave different values. Which one make different calculation , please let me know...Advance in thanks...

author: sokoloff
author_rank: Super Contributor
timestamp: March 30, 2019, 03:12:04 pm
content: Is something somewhere else in the program setting the global variable pulse and then the if statement for edge2 > edge1 not firing on that time through the code? To check for this, search around in your code or make a new variable "double TOTALLY_NEW_VARIABLE_NO_ONE_IS_USING_THIS;" and use that in place of pulse.Secondly, are you meaning to test edge3> edge2in the second if and then subtract edge3- edge1? As the code is written, if edge1 and edge3 are equal and edge3 is greater than edge2, your code will do a divide by zero.Third, I'd recommend that you cast to double before doing the MHz division rather than after. That's not going to fix your issue, but is good practice.Code:pulse = ((double) 1000000 / (double) freq1) ;If you're still stuck, I'd recommend copy pasting the code into a program that we can all run (meaning that has variable assignments along the way and doesn't depend on guessing what else is in the program). In trying to write that, you'll often discover the issue on your own. (often calledRubber Duck Debugging)

author: Nerull
author_rank: Frequent Contributor
timestamp: March 30, 2019, 04:36:36 pm
content: The code you posted doesn't function, so clearly it is not all of the code in question.Is any of this code interrupt driven?

author: bson
author_rank: Unknown
timestamp: March 30, 2019, 06:13:47 pm
content: Add edge1, edge2, edge3 to the output to make sure they're set correctly.