Author Topic: TI Free Sample came with pre-loaded code...  (Read 3411 times)

0 Members and 1 Guest are viewing this topic.

Offline tom66Topic starter

  • Super Contributor
  • ***
  • Posts: 7218
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
TI Free Sample came with pre-loaded code...
« on: March 20, 2014, 12:15:47 am »
I recently sampled some TM4C123GH6PM microcontrollers in TQFP64 package. I just got my board working, before JTAG was fully connected, surprisingly I had one LED lit up on the board. I checked the crystal and sure enough it was oscillating at 16MHz. On the Tiva processors, like most MCUs, this will not happen until you write a program to turn the oscillator on.

What could cause this? The only conclusion I could make is that I got an already programmed chip which is a little worrying as the samples should have been straight from Digi-Key stock.

Odd, in the very least. It did work as expected when erased and reprogrammed. Perhaps I should have tried to copy the free sample program off.
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: TI Free Sample came with pre-loaded code...
« Reply #1 on: March 20, 2014, 02:15:16 am »
I presume it was some sort of bootloader. All ATMEGAxxUx come preprogrammed as well unless you specifically ask for them to be blank.
 

Offline tom66Topic starter

  • Super Contributor
  • ***
  • Posts: 7218
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: TI Free Sample came with pre-loaded code...
« Reply #2 on: March 20, 2014, 03:00:23 pm »
That sounds reasonable, odd though. What would happen if I installed it into a system with some safety controls? OK maybe that's a little out there and you'd be an idiot to program a system while it is dangerous but what if it failed to program and you tried to test it...

Seems kind of odd. Guess I'll get curious eventually and check the other chip, maybe it will have some code I can dump off it.
 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1195
  • Country: ca
    • VE7XEN Blog
Re: TI Free Sample came with pre-loaded code...
« Reply #3 on: March 21, 2014, 06:33:17 am »
The bootloader on these is in ROM, and the datasheet at least says that it uses the internal oscillator. So yeah, kinda weird.
73 de VE7XEN
He/Him
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: TI Free Sample came with pre-loaded code...
« Reply #4 on: March 21, 2014, 11:21:34 am »
It is not really odd. The MCU starts and probably executes from an empty FLASH memory, after the bootloader relinquishes control.

If the FLASH is empty, e.g. all FF, the MCU will try to interpret FF or groups of FF as opcodes. There might be a corresponding opcode or it might be illegal. Depending if the opcode has a meaning, how the MCU is build etc. a number of things might happen. E.g. the MCU running through memory, wrapping around, at some point maybe hitting the bootloader again. Or continuing triggering a reset because of a bad opcode, reseting into the bootloader. This and a bunch of other events can look like some program causing some periodic event happening.

MCUs in safety environments should of course not do that, so you pay extra for an MCU.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: TI Free Sample came with pre-loaded code...
« Reply #5 on: March 21, 2014, 03:21:44 pm »
I think it would be better to not connect to safety equipment until you've got your real program loaded.
The larger the government, the smaller the citizen.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 28300
  • Country: nl
    • NCT Developments
Re: TI Free Sample came with pre-loaded code...
« Reply #6 on: March 21, 2014, 06:56:44 pm »
It is not really odd. The MCU starts and probably executes from an empty FLASH memory, after the bootloader relinquishes control.

If the FLASH is empty, e.g. all FF, the MCU will try to interpret FF or groups of FF as opcodes. There might be a
That is why most modern microcontrollers treat 0xff as NOP.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline tom66Topic starter

  • Super Contributor
  • ***
  • Posts: 7218
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: TI Free Sample came with pre-loaded code...
« Reply #7 on: March 21, 2014, 09:30:08 pm »
If the FLASH is empty, e.g. all FF, the MCU will try to interpret FF or groups of FF as opcodes. There might be a corresponding opcode or it might be illegal. Depending if the opcode has a meaning, how the MCU is build etc. a number of things might happen. E.g. the MCU running through memory, wrapping around, at some point maybe hitting the bootloader again. Or continuing triggering a reset because of a bad opcode, reseting into the bootloader. This and a bunch of other events can look like some program causing some periodic event happening.

That is odd, so the micro could have been executing random code that just happened to start the crystal, enable the GPIO port peripheral cloc for Port A, enable the port pin including drive strength setting, turn the port pin to an output -and- output a logic high? 

I'm not buying it...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf