Punch tape


  • Home

  • About

  • Archives

  • Tags

Issues with the built-in function range(), xrange() in Python 2.x/3.x

Posted on 2017-01-15 |

TL;DR

Jump to second part, the first part illustrate how did I found the problem, which is not interesting at all.

How did I find this problem

Recently, my roommate is practicing for interview with Leetcode, he keeps coming to ask for my help with some problems. The problems in Leetcode are really easy (especially when compared with problems in OJs oriented for ACM), but if you keep sensitive, it could still help you find some corner in the language that you would never notice otherwise.

Here is my log about investigating difference of range() between python2 and python3 - and their different against xrange().

Read more »

STM32 - 1-Wire protocol analysis & Implementing of OneWire Protocol using UART peripheral and DMA

Posted on 2016-05-28 |

TL;DR

If you just want to use 1-wire based device and just don’t want to know any technical detail, jump to the last part.

Reason to use DS18B20

I’m trying to add some temperature sensor to my STM32-based computer water-cooling controller.

You know, a common solution to this is to use some thermistor and try to use some ADC(Analog-Digital-Converter) to capture the voltage on that. The temperature captured by thermistor won’t be too accurate, just around 1 degree or so. If you need a temperature with accuracy of 0.0625 degree, the DS18B20 would be a good choice.

But DS18B20 has an really time sensitive 1-wire protocol. A normal solution to this problem is to use GPIO and NOP() instruction to simulate this, but I tend to use something different.

Read more »

A solution to I2C/IIC bug in STM32

Posted on 2016-05-21 |

What’s the problem with I2C of STM32?

The STM32 chips are all really good designed, coming with a really nice price - for a normal, wide-used STM32F1, the price is around 1-2 bucks in some small scale order. If take the fact that ST is really nice to small order and always willing to give a good price, everything about STM32 seems so perfect.

However, such bargain has its own weakness - its own I2C peripheral has some really serious hardware bug, that it is really sensitive to the time sequence, even interrupted by a small function, the peripheral would fail. An application engineering of STMicroelectronics has mention their concern in an offline meeting. She said the I2C peripheral is designed like this on purposely, just to avoid some strict patent of NXP. Check here

Read more »
cnnblike@gmail.com

cnnblike@gmail.com

3 posts
3 tags
RSS
© 2019 cnnblike@gmail.com
Powered by Hexo
Theme - NexT.Muse