Shenzen Titan Microelectronics

fernando_g

Senior Member
It appears that most new interesting ICs are coming from previously unknown Chinese companies.
I recently “discovered” Shenzen Titan Microelectronics, which has several very desirable ICs which of course, have available evaluation boards at rock bottom prices.
One such IC is the TM1638, which can drive 8 seven segment displays and 16 push buttons via a simple SPI interface.
I plan ordering a board soon, but was wondering whether anyone has already played with these devices.

 

inglewoodpete

Senior Member
I had a speed-read of the data sheet and its Ar*no code but it is not clear to me if the TM1368 allows separate reads and writes via SPI. I have not done much work with Ar*nos. I have never been able to do a combination or "full duplex" SPI read and write action with a PICAXE - it is either one or the other. I've even tried using PeekSFR and PokeSFR with no luck in any combination. The PICAXE's firmware seems to have a firm grip on the SPI SFRs.
 

AllyCat

Senior Member
Hi,
I've even tried using PeekSFR and PokeSFR with no luck in any combination. The PICAXE's firmware seems to have a firm grip on the SPI SFRs.
Hmm, that sounds very disappointing. I had hoped to write some subroutines/macros to give "Full Duplex SPI" capabilities for M2 chips, particularly to control ISM radio chips such as the RFM69. I would NOT have "expected" the Operating System/Interpreter of M2 chips to access the SPI SFRs at all. Might this limitation be restricted to X2 chips only?

Cheers, Alan.
 

fernando_g

Senior Member
Pete;
Let me see if I understand what you are saying:

Does it mean that with a Picaxe, one could only use the TM1638 either as an input expander or an output expander but not both functions simultaneously?
 

inglewoodpete

Senior Member
Yes, there are two commands: ShiftIn and ShiftOut. You will see from the command parameters for ShiftIn that the syntax has no provision to send bytes and vice versa for ShiftOut. It should be possible to bit-bang a bothway transaction but that would be very slow.

Having said that, the TM1638 documentation is vague (and uncommented) for me, a non-Ar*no user. I'm well versed in PICAXE BASIC and Microchip C.
 

fernando_g

Senior Member
This is the full datasheet, in English, and it is much better documented than the board.
Even if I could only use the device as either “I” or “O” expander, its very low cost makes it worth investigating.
 
Last edited:

inglewoodpete

Senior Member
Hmm, that sounds very disappointing. I had hoped to write some subroutines/macros to give "Full Duplex SPI" capabilities for M2 chips, particularly to control ISM radio chips such as the RFM69. I would NOT have "expected" the Operating System/Interpreter of M2 chips to access the SPI SFRs at all. Might this limitation be restricted to X2 chips only?
Cheers, Alan.
Yes, only the X2 chips access their hardware SPI modules. I tried to use hSPIxxx commands for "Full Duplex SPI" on a 28X2 some years ago without any success. The bit-banged solution on a PICAXE was far too slow for my project so I had to port my code to Microchip C (same underlying chip: PIC18F25K22) - not a particularly simple task :unsure:.

I had not tested the SPI capabilities of the PICAXE M2 chips before today. They don't have hardware SPI commands available (hSPIIn/hSPIOut). I just did a syntax check on each of the four M2 chips and they all need user-prepared bit-bang code to do SPI. So "Full Duplex SPI" is available if you write your own bit-banged code. As mentioned previously, this option is also available for X2 chips.
 

inglewoodpete

Senior Member
This is the full datasheet, in English, and it is much better documented than the board.
Even if I could only use the device as either “I” or “O” expander, its very low cost makes it worth investigating.
Reading the datasheet's section on "Pin Function", for the STB pin it says "The first byte after STB becomes low is considered as an instruction", indicating that a write is required for a read to happen. This would appear to rule out the option of using the PICAXE X2's hSPIxxx hardware SPI commands. However, if speed is not critical you still have the user-prepared bit-bang option.
 
Top